From d3ea4f08e57ffeb3e3ffe7e76aec0654ddaaa23d Mon Sep 17 00:00:00 2001 From: HONG Yifan Date: Wed, 21 May 2025 18:26:32 +0000 Subject: [PATCH] ANDROID: KVM: arm64: allow nvhe/trace.h for in-tree/DDK pKVM modules For both in-tree and DDK pKVM modules, it is now adviced to use nvhe/trace.h instead of a simple trace.h. This is clearer. Putting it in `nvhe/` also allows us to add pkvm_headers_aarch64 to all_headers_allowlist_aarch64 directly, so that DDK pKVM modules don't have to add pkvm_headers_aarch64 explicitly. To keep backwards compatibility, this commit does not disallow using `#include "trace.h"` directly. This will be removed in the follow up CL. To keep in-tree and DDK pKVM modules's -I flags in sync, add an IFTTT block. NO_IFTTT=This is the initial creation of the block. Bug: 416603216 Bug: 357781595 Change-Id: Iac90750d4442539d12099eb09ba4cb2946956ef2 Signed-off-by: HONG Yifan --- BUILD.bazel | 17 +++++++++++++++++ arch/arm64/kvm/hyp/nvhe/Makefile.module | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/BUILD.bazel b/BUILD.bazel index ad30127d2d4f..8afd0c9d0844 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1632,6 +1632,22 @@ ddk_headers( # Implementation details for DDK headers. The targets below cannot be directly # depended on by DDK modules. +# Headers for building pKVM modules. They are for pKVM only so not added to +# all_headers_aarch64. +ddk_headers( + name = "pkvm_headers_aarch64", + hdrs = [ + "arch/arm64/kvm/hyp/include/module/nvhe/define_events.h", + "arch/arm64/kvm/hyp/include/module/nvhe/trace.h", + ], + includes = [ + # LINT.IfChange(pkvm_includes) + "arch/arm64/kvm/hyp/include/module", + # LINT.ThenChange(/arch/arm64/kvm/hyp/nvhe/Makefile.module:includes) + ], + visibility = ["//visibility:private"], +) + # Headers needed to include drivers/usb/host/xhci.h. ddk_headers( name = "xhci_headers", @@ -1670,6 +1686,7 @@ ddk_headers( ":all_headers_allowlist_aarch64_globs", ":all_headers_allowlist_common_globs", ":all_headers_allowlist_exynos", + ":pkvm_headers_aarch64", ":xhci_headers", ], # The list of include directories where source files can #include headers diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile.module b/arch/arm64/kvm/hyp/nvhe/Makefile.module index af84ae2a5d86..749d1ee90d79 100644 --- a/arch/arm64/kvm/hyp/nvhe/Makefile.module +++ b/arch/arm64/kvm/hyp/nvhe/Makefile.module @@ -5,5 +5,11 @@ $(obj)/hyp.lds: arch/arm64/kvm/hyp/nvhe/module.lds.S FORCE include $(srctree)/arch/arm64/kvm/hyp/nvhe/Makefile.nvhe +# Deprecated; subject to removal. ccflags-y += -I$(srctree)/arch/arm64/kvm/hyp/include/module/nvhe + +# LINT.IfChange(includes) +ccflags-y += -I$(srctree)/arch/arm64/kvm/hyp/include/module +# LINT.ThenChange(/BUILD.bazel:pkvm_includes) + ccflags-y += -DMODULE