[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] XSM: make PCI hooks dependent upon HAS_PCI=y



commit d9605dee5cb20e7f833d5f26730faec82b206764
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Aug 3 16:34:32 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Aug 3 16:34:32 2026 +0200

    XSM: make PCI hooks dependent upon HAS_PCI=y
    
    They're unreachable / dead otherwise. Really resource_{,un}plug_pci() is
    further limited to PCI pass-through.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
 xen/include/xsm/dummy.h | 10 ++++++++++
 xen/include/xsm/hooks.h | 13 ++++++++-----
 xen/xsm/flask/hooks.c   | 10 ++++++++++
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 8fb73d032c..b777c2eb47 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -394,6 +394,8 @@ static XSM_INLINE int cf_check xsm_get_device_group(
 }
 #endif /* HAS_PASSTHROUGH && HAS_PCI */
 
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI)
+
 static XSM_INLINE int cf_check xsm_resource_plug_pci(
     XSM_DEFAULT_ARG uint32_t machine_bdf)
 {
@@ -408,6 +410,10 @@ static XSM_INLINE int cf_check xsm_resource_unplug_pci(
     return xsm_default_action(action, current->domain, NULL);
 }
 
+#endif /* CONFIG_HAS_PASSTHROUGH && CONFIG_HAS_PCI */
+
+#ifdef CONFIG_HAS_PCI
+
 static XSM_INLINE int cf_check xsm_resource_setup_pci(
     XSM_DEFAULT_ARG uint32_t machine_bdf)
 {
@@ -421,6 +427,8 @@ static XSM_INLINE int cf_check 
xsm_resource_setup_gsi(XSM_DEFAULT_ARG int gsi)
     return xsm_default_action(action, current->domain, NULL);
 }
 
+#endif /* CONFIG_HAS_PCI */
+
 static XSM_INLINE int cf_check xsm_resource_setup_misc(XSM_DEFAULT_VOID)
 {
     XSM_ASSERT_ACTION(XSM_PRIV);
@@ -524,6 +532,7 @@ static XSM_INLINE int cf_check xsm_iomem_mapping_vpci(
     return xsm_default_action(action, current->domain, d);
 }
 
+#ifdef CONFIG_HAS_PCI
 static XSM_INLINE int cf_check xsm_pci_config_permission(
     XSM_DEFAULT_ARG struct domain *d, uint32_t machine_bdf, uint16_t start,
     uint16_t end, uint8_t access)
@@ -531,6 +540,7 @@ static XSM_INLINE int cf_check xsm_pci_config_permission(
     XSM_ASSERT_ACTION(XSM_HOOK);
     return xsm_default_action(action, current->domain, d);
 }
+#endif /* CONFIG_HAS_PCI */
 
 static XSM_INLINE int cf_check xsm_add_to_physmap(
     XSM_DEFAULT_ARG struct domain *d1, struct domain *d2)
diff --git a/xen/include/xsm/hooks.h b/xen/include/xsm/hooks.h
index 97b0d95169..1ca935a43d 100644
--- a/xen/include/xsm/hooks.h
+++ b/xen/include/xsm/hooks.h
@@ -77,21 +77,24 @@ XSM_HOOK(int, unbind_pt_irq, struct domain *, struct 
xen_domctl_bind_pt_irq *)
 
 XSM_HOOK(int, irq_permission, struct domain *, int, uint8_t)
 XSM_HOOK(int, iomem_permission, struct domain *, uint64_t, uint64_t, uint8_t)
-XSM_HOOK(int, pci_config_permission, struct domain *, uint32_t, uint16_t,
-                                     uint16_t, uint8_t)
 
 XSM_HOOK(int, iomem_mapping, struct domain *, uint64_t, uint64_t, uint8_t)
 XSM_HOOK(int, iomem_mapping_vpci, struct domain *, uint64_t, uint64_t, uint8_t)
 
 #if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI)
+XSM_HOOK(int, resource_plug_pci, uint32_t)
+XSM_HOOK(int, resource_unplug_pci, uint32_t)
 XSM_HOOK(int, get_device_group, uint32_t)
 #endif
 
-XSM_HOOK(int, resource_plug_pci, uint32_t)
-XSM_HOOK(int, resource_unplug_pci, uint32_t)
+XSM_HOOK(int, resource_setup_misc)
+
+#ifdef CONFIG_HAS_PCI
 XSM_HOOK(int, resource_setup_pci, uint32_t)
 XSM_HOOK(int, resource_setup_gsi, int)
-XSM_HOOK(int, resource_setup_misc)
+XSM_HOOK(int, pci_config_permission, struct domain *, uint32_t, uint16_t,
+                                     uint16_t, uint8_t)
+#endif
 
 XSM_HOOK(int, hypfs_op)
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index bd9d9e1bcf..8b1834ca0a 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1225,6 +1225,7 @@ static int cf_check flask_iomem_mapping(struct domain *d, 
uint64_t start, uint64
 }
 #define flask_iomem_mapping_vpci flask_iomem_mapping
 
+#ifdef CONFIG_HAS_PCI
 static int cf_check flask_pci_config_permission(
     struct domain *d, uint32_t machine_bdf, uint16_t start, uint16_t end,
     uint8_t access)
@@ -1250,6 +1251,7 @@ static int cf_check flask_pci_config_permission(
     return avc_has_perm(dsid, rsid, SECCLASS_RESOURCE, perm, &ad);
 
 }
+#endif /* CONFIG_HAS_PCI */
 
 #if defined(CONFIG_SYSCTL) || defined(CONFIG_X86)
 static int flask_resource_plug_core(void)
@@ -1270,6 +1272,8 @@ static int flask_resource_use_core(void)
 }
 #endif /* CONFIG_SYSCTL */
 
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI)
+
 static int cf_check flask_resource_plug_pci(uint32_t machine_bdf)
 {
     uint32_t rsid;
@@ -1300,6 +1304,10 @@ static int cf_check flask_resource_unplug_pci(uint32_t 
machine_bdf)
     return avc_current_has_perm(rsid, SECCLASS_RESOURCE, RESOURCE__UNPLUG, 
&ad);
 }
 
+#endif /* CONFIG_HAS_PASSTHROUGH && CONFIG_HAS_PCI */
+
+#ifdef CONFIG_HAS_PCI
+
 static int cf_check flask_resource_setup_pci(uint32_t machine_bdf)
 {
     uint32_t rsid;
@@ -1328,6 +1336,8 @@ static int cf_check flask_resource_setup_gsi(int gsi)
     return avc_current_has_perm(rsid, SECCLASS_RESOURCE, RESOURCE__SETUP, &ad);
 }
 
+#endif /* CONFIG_HAS_PCI */
+
 static int cf_check flask_resource_setup_misc(void)
 {
     return avc_current_has_perm(SECINITSID_XEN, SECCLASS_RESOURCE, 
RESOURCE__SETUP, NULL);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.