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

[PATCH v2] generic/altp2m: align and simplify altp2m_vcpu_idx()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Thu, 9 Jul 2026 15:23:30 +0000
  • Accept-language: en-US, uk-UA, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Dlyv5Fbi51wIjxmvgcBF97mzr/mGIUpsoVE/xwMklTg=; b=RXLWeiCEbDr44UHhtTFeFJUf6t1Q2oidBPRQHrbvh8QiwEtGnYZaH/2twGJYY+/YHjJvWl+WtjLB7oTFos+id/PTUl7uICn0KD3k+LwA8AUbmAqqAex6ZYf0GBy+NsljddG9gItC8pbiolmY7q038HOWNNM1DsJRw0Dmrz9gRV6CcsjQ3tEIPTcKoCXpf0lulTVXj9lBEAMda36bMcotjJfKJ+YBmKCeCwQW78nyaBsZZhzXC0Ht0Xqc2cZQEYsYpdWm9QyUqTF5bUIE+LYZl5unALUgB2HdMcu78+HrxdxKqK+3SDgiSqv50ygQWKo/ZhietQglWf2wA8Feu8t76g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NPPpOE6RDMnRrtIC15Y3TfvQyPHgMrmMyw3krLEuilLxPDvE/SSYhCd+98zPlwLJ4e6Wj3z4cPrADiK1CdpzQsXFQvdjcnoaZHTzoub0Waif7nWgFHV9xMkIMwmBuGIj0xKYCj33gqKMaeMcyeGIkqz4ggLiWGimDKCxNDlgOb/lO/ME3Fuyc9hFnk2xTdjRpmxaE261p0597hQJQMl5tVcDAt83uA2/BhU++dLGl99QDBz1MXE83zi4BUrEpL6CTfAlR63pXAF5fZWqZaznCXOtXqC+IP/8p6CZ4Gt/aK/RrMidFuhaacQhB15ZBq0fFb7wJ7G3MB3mfr6Vn8ZiJw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 09 Jul 2026 15:23:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdD7blJ03yOJ48I0W3XaixAGyTqg==
  • Thread-topic: [PATCH v2] generic/altp2m: align and simplify altp2m_vcpu_idx()

The return type of altp2m_vcpu_idx() in the generic altp2m.h header is
currently 'unsigned int', which is inconsistent with its uint16_t
return type on x86 and the altp2m_idx member of the monitor structures.

To fix this type inconsistency and simplify the header, this patch
replaces the static inline implementation of altp2m_vcpu_idx()
(contained a BUG() stub) with a simple function declaration returning
uint16_t.

For architectures using the generic altp2m.h header (such as ARM when
CONFIG_VM_EVENT is enabled), common code calls to altp2m_vcpu_idx() in
common/monitor.c are guarded by altp2m_active(), which statically
returns false. The compiler DCE will optimize out these calls, avoiding
any linker issues for the missing definition.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
---
Changes in v2:
- add Stefano's comment regarding return type
- rewrite commit subject and message
Test CI pipeline:
https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/2665080481
---
 xen/include/asm-generic/altp2m.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/xen/include/asm-generic/altp2m.h b/xen/include/asm-generic/altp2m.h
index 39865a842a..df6b9a9c01 100644
--- a/xen/include/asm-generic/altp2m.h
+++ b/xen/include/asm-generic/altp2m.h
@@ -15,12 +15,7 @@ static inline bool altp2m_active(const struct domain *d)
 }
 
 /* Alternate p2m VCPU */
-static inline unsigned int altp2m_vcpu_idx(const struct vcpu *v)
-{
-    /* Not implemented on GENERIC, should not be reached. */
-    BUG();
-    return 0;
-}
+uint16_t altp2m_vcpu_idx(const struct vcpu *v);
 
 #endif /* __ASM_GENERIC_ALTP2M_H */
 
-- 
2.43.0



 


Rackspace

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