All of lore.kernel.org
 help / color / mirror / Atom feed
From: Penny Zheng <Penny.Zheng@amd.com>
To: <xen-devel@lists.xenproject.org>
Cc: ray.huang@amd.com, oleksii.kurochko@gmail.com,
	"Penny Zheng" <Penny.Zheng@amd.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Stewart Hildebrand" <stewart.hildebrand@amd.com>,
	"Daniel P. Smith" <dpsmith@apertussolutions.com>
Subject: [PATCH v3 01/28] xen/xsm: remove redundant xsm_iomem_mapping()
Date: Mon, 13 Oct 2025 18:15:13 +0800	[thread overview]
Message-ID: <20251013101540.3502842-2-Penny.Zheng@amd.com> (raw)
In-Reply-To: <20251013101540.3502842-1-Penny.Zheng@amd.com>

Function xsm_iomem_mapping() seems redundant, and in flask policy, it just
directly calls xsm_iomem_permission().
Remove it and use xsm_iomem_permission() instead, with the benefit of a
cf_check disappearing too.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v2 -> v3:
- new commit
---
 xen/common/domctl.c       | 2 +-
 xen/drivers/vpci/header.c | 2 +-
 xen/include/xsm/dummy.h   | 7 -------
 xen/include/xsm/xsm.h     | 8 --------
 xen/xsm/dummy.c           | 1 -
 xen/xsm/flask/hooks.c     | 6 ------
 6 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 954d790226..71ebeff494 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -701,7 +701,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
              !iomem_access_permitted(d, mfn, mfn_end) )
             break;
 
-        ret = xsm_iomem_mapping(XSM_HOOK, d, mfn, mfn_end, add);
+        ret = xsm_iomem_permission(XSM_HOOK, d, mfn, mfn_end, add);
         if ( ret )
             break;
 
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 469f497744..1ff6c63f4d 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -67,7 +67,7 @@ static int cf_check map_range(
             return -EPERM;
         }
 
-        rc = xsm_iomem_mapping(XSM_HOOK, map->d, map_mfn, m_end, map->map);
+        rc = xsm_iomem_permission(XSM_HOOK, map->d, map_mfn, m_end, map->map);
         if ( rc )
         {
             printk(XENLOG_G_WARNING
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 12792c3a43..5e29165763 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -570,13 +570,6 @@ static XSM_INLINE int cf_check xsm_iomem_permission(
     return xsm_default_action(action, current->domain, d);
 }
 
-static XSM_INLINE int cf_check xsm_iomem_mapping(
-    XSM_DEFAULT_ARG struct domain *d, uint64_t s, uint64_t e, uint8_t allow)
-{
-    XSM_ASSERT_ACTION(XSM_HOOK);
-    return xsm_default_action(action, current->domain, d);
-}
-
 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)
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 9a23d2827c..34caad2f7e 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -116,8 +116,6 @@ struct xsm_ops {
     int (*irq_permission)(struct domain *d, int pirq, uint8_t allow);
     int (*iomem_permission)(struct domain *d, uint64_t s, uint64_t e,
                             uint8_t allow);
-    int (*iomem_mapping)(struct domain *d, uint64_t s, uint64_t e,
-                         uint8_t allow);
     int (*pci_config_permission)(struct domain *d, uint32_t machine_bdf,
                                  uint16_t start, uint16_t end, uint8_t access);
 
@@ -517,12 +515,6 @@ static inline int xsm_iomem_permission(
     return alternative_call(xsm_ops.iomem_permission, d, s, e, allow);
 }
 
-static inline int xsm_iomem_mapping(
-    xsm_default_t def, struct domain *d, uint64_t s, uint64_t e, uint8_t allow)
-{
-    return alternative_call(xsm_ops.iomem_mapping, d, s, e, allow);
-}
-
 static inline int xsm_pci_config_permission(
     xsm_default_t def, struct domain *d, uint32_t machine_bdf, uint16_t start,
     uint16_t end, uint8_t access)
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 8b7e01b506..86daca3e89 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -75,7 +75,6 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
     .unbind_pt_irq                 = xsm_unbind_pt_irq,
     .irq_permission                = xsm_irq_permission,
     .iomem_permission              = xsm_iomem_permission,
-    .iomem_mapping                 = xsm_iomem_mapping,
     .pci_config_permission         = xsm_pci_config_permission,
     .get_vnumainfo                 = xsm_get_vnumainfo,
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index b0308e1b26..e98920dd52 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1167,11 +1167,6 @@ static int cf_check flask_iomem_permission(
     return security_iterate_iomem_sids(start, end, _iomem_has_perm, &data);
 }
 
-static int cf_check flask_iomem_mapping(struct domain *d, uint64_t start, uint64_t end, uint8_t access)
-{
-    return flask_iomem_permission(d, start, end, access);
-}
-
 static int cf_check flask_pci_config_permission(
     struct domain *d, uint32_t machine_bdf, uint16_t start, uint16_t end,
     uint8_t access)
@@ -1945,7 +1940,6 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
     .unbind_pt_irq = flask_unbind_pt_irq,
     .irq_permission = flask_irq_permission,
     .iomem_permission = flask_iomem_permission,
-    .iomem_mapping = flask_iomem_mapping,
     .pci_config_permission = flask_pci_config_permission,
 
     .resource_plug_core = flask_resource_plug_core,
-- 
2.34.1



  reply	other threads:[~2025-10-13 10:16 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 10:15 [PATCH v3 00/28] Disable domctl-op via CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-13 10:15 ` Penny Zheng [this message]
2025-10-13 11:18   ` [PATCH v3 01/28] xen/xsm: remove redundant xsm_iomem_mapping() Jan Beulich
2025-10-13 10:15 ` [PATCH v3 02/28] xen/mem_sharing: wrap hvm_copy_context_and_params() with CONFIG_MEM_SHARING Penny Zheng
2025-10-14 14:43   ` Grygorii Strashko
2025-10-28 17:01   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 03/28] xen/altp2m: move p2m_set_suppress_ve_multi() forward Penny Zheng
2025-10-28 17:03   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 04/28] xen/sched: remove vcpu_set_soft_affinity() Penny Zheng
2025-10-13 10:24   ` Jürgen Groß
2025-10-13 10:15 ` [PATCH v3 05/28] xen/sysctl: replace CONFIG_SYSCTL with CONFIG_MGMT_DOMCTL Penny Zheng
2025-10-13 10:41   ` Jürgen Groß
2025-10-29 14:30   ` Jan Beulich
2025-10-29 21:26   ` Stewart Hildebrand
2025-11-19  6:33     ` Penny, Zheng
2025-10-13 10:15 ` [PATCH v3 06/28] xen/x86: move domctl.o out of PV_SHIM_EXCLUSIVE Penny Zheng
2025-10-29 14:33   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 07/28] xen/domctl: make MGMT_HYPERCALLS transiently def_bool Penny Zheng
2025-10-29 14:37   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 09/28] xen/vm_event: consolidate CONFIG_VM_EVENT Penny Zheng
2025-10-21 13:24   ` Grygorii Strashko
2025-10-29 15:57   ` Jan Beulich
2025-11-11  7:08     ` Penny, Zheng
2025-11-11  8:13       ` Jan Beulich
2025-11-11  9:46         ` Penny, Zheng
2025-10-13 10:15 ` [PATCH v3 10/28] xen/vm_event: make VM_EVENT depend on CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-13 10:15 ` [PATCH v3 11/28] xen/xsm: wrap xsm_vm_event_control() with CONFIG_VM_EVENT Penny Zheng
2025-10-13 10:15 ` [PATCH v3 12/28] xen/domctl: wrap domain_pause_by_systemcontroller() with MGMT_HYPERCALLS Penny Zheng
2025-10-30 11:28   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 13/28] xen/domctl: wrap domain_soft_reset() with CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-30 12:14   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 14/28] xen/domctl: wrap domain_resume() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 15/28] xen/domctl: wrap domain_kill() " Penny Zheng
2025-10-30 12:43   ` Jan Beulich
2025-11-12  8:58     ` Penny, Zheng
2025-11-12 10:02       ` Jan Beulich
2025-11-13  4:11         ` Penny, Zheng
2025-11-13  4:40     ` Penny, Zheng
2025-10-13 10:15 ` [PATCH v3 16/28] xen/domctl: wrap domain_set_node_affinity() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 17/28] xen/domctl: wrap vcpu_affinity_domctl() " Penny Zheng
2025-10-13 10:44   ` Jürgen Groß
2025-10-13 10:15 ` [PATCH v3 18/28] xen/domctl: wrap sched_adjust() " Penny Zheng
2025-10-13 11:03   ` Jürgen Groß
2025-10-13 11:13     ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 19/28] xen/domctl: wrap xsm_irq_permission " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 20/28] xen/domctl: wrap arch-specific domain_set_time_offset() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 21/28] xen/domctl: wrap xsm_set_target() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 22/28] xen/domctl: wrap iommu-related domctl op " Penny Zheng
2025-10-30 13:09   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 23/28] xen/domctl: wrap arch_{get,set}_paging_mempool_size() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 24/28] xen/domctl: make CONFIG_X86_PSR depend on CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-13 10:15 ` [PATCH v3 25/28] xen/domctl: avoid unreachable codes when both MGMT_HYPERCALLS and MEM_SHARING unset Penny Zheng
2025-10-30 13:13   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 26/28] xen/domctl: wrap arch-specific domctl-op with CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-30 13:24   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 27/28] xen/domctl: make HVM_PARAM_IDENT_PT conditional upon CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-30 13:34   ` Jan Beulich
2025-11-18  6:45     ` Penny, Zheng
2025-11-18  7:12       ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 28/28] xen/domctl: wrap common/domctl.c with CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-30 13:40   ` Jan Beulich
2025-11-18  6:43     ` Penny, Zheng
2025-11-18  7:14       ` Jan Beulich
2025-11-18  7:51         ` Penny, Zheng
2025-11-18 19:29           ` Jason Andryuk
2025-11-20  4:09             ` Penny, Zheng
     [not found] ` <20251013101540.3502842-9-Penny.Zheng@amd.com>
2025-10-29 15:02   ` [PATCH v3 08/28] xen/vm_event: introduce vm_event_is_enabled() Jan Beulich
2025-10-30 11:10     ` Grygorii Strashko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251013101540.3502842-2-Penny.Zheng@amd.com \
    --to=penny.zheng@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=dpsmith@apertussolutions.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=ray.huang@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=stewart.hildebrand@amd.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.