From nobody Thu Oct 30 23:12:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1753954105; cv=none; d=zohomail.com; s=zohoarc; b=jFQ71aDd/H+pjDlt2MgnH/IanRtcVAGUf4ZAKdMJ5oRS64RL3gUR/9JW5tm/fzlAijlA/YL6brekHcrynDHiBqj+SkGwAuuV80u2+0j+UgB8msneBuk/GZB0ybNqrErfyYB4VdCeQncFGyQHIbcNbiwNxwFTSiJM2molBuzqR6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753954105; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VdUDk8PNeElBQFIXVeH+4JTV5pz3z+NOKkKyz1LFf2U=; b=J5ltLzon1Skj6Lzet5mGgEbZWoq6/0Po3ZmjjuQnIQHayaCCTeetzqer9qKWH2YNsJ2s0m9t3knycg/8R3oMTcfsuZM5tEoFaXcG1z1hBnY0h898I4ljTV/anF9+zQXldBYqc2M3O3v+BOa4Kp+BLs/qyOC5oontZ+yQRHRxdVw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1753954105502153.62462199534286; Thu, 31 Jul 2025 02:28:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1065150.1430496 (Exim 4.92) (envelope-from ) id 1uhPa8-0000M5-Sg; Thu, 31 Jul 2025 09:28:12 +0000 Received: by outflank-mailman (output) from mailman id 1065150.1430496; Thu, 31 Jul 2025 09:28:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uhPa8-0000LC-Lw; Thu, 31 Jul 2025 09:28:12 +0000 Received: by outflank-mailman (input) for mailman id 1065150; Thu, 31 Jul 2025 09:28:11 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uhPa7-0000Jb-AZ for xen-devel@lists.xenproject.org; Thu, 31 Jul 2025 09:28:11 +0000 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [2a00:1450:4864:20::330]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ac1871b7-6df0-11f0-b895-0df219b8e170; Thu, 31 Jul 2025 11:28:09 +0200 (CEST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-456053b5b8cso958275e9.3 for ; Thu, 31 Jul 2025 02:28:09 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-458953cfcc1sm60905485e9.17.2025.07.31.02.28.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Jul 2025 02:28:08 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ac1871b7-6df0-11f0-b895-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753954089; x=1754558889; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VdUDk8PNeElBQFIXVeH+4JTV5pz3z+NOKkKyz1LFf2U=; b=W5s9AU48HEztfQElEyALu36g8EOW7LFaYMund+6XxQ8krzuJZvQHjY+4CmFz/BxIUY F9ZBJ8jCqFvrYHQbQE/jwE/Yh9nz2xwfuyaalGdke4Ct+51mOrNnVW/zsfCpTQl3AaKq d7RkNtko0/CDYHZ2tB/PI3rJRCwYnAGBIPnmywAOdXHw38A5qzlPq/gb7e9ad9ohsZGS Ru/rv49XewJpWuW12LoxFhW7GTXIO4SMBCdQCT4AGEDw3fIgGRwmN+sk1qWlTRylv00k feZnuQv1YZkyBNP/xxHlGHYPgK8u+nrYzGI9zVoynbnX3Dx0YCDaGQ/dywcIMlhPh87S eTRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753954089; x=1754558889; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VdUDk8PNeElBQFIXVeH+4JTV5pz3z+NOKkKyz1LFf2U=; b=hloyoCdu+DySIaQEhp/4Z35udMAr1bA81VTrWgfxiqgegN7LdXsnBY34ULtPuZL4zR v3iTRiWqBDjxg0FwEnMOzvGCk6GcyfY8sRbZT/i6GufRcWJQ6KjhfEIgCfHSBX8ZFMtv pd3bkYZ8MaiaFhNRu/Ql1RccjU377zExu3appiCZipEzYtX0au9m9zQ2608xsVXKgY73 DKd+TofP40Sc8b8rVQD157hi0BbsV5XubCOYlHhwvvKc/f8ZRbpJap6Um5dmUXVuK9SI DDIvVPV01A+lZVMg0MmBxWGdHaZd4dPKyWfyNWbfnyXEBvHmu9uKwMKxlltcfD64EV81 WexQ== X-Gm-Message-State: AOJu0YxpCD5wrWNMrMU++gIUSlX7HJgPHOB8f3bTXUVrc3Fdz+mODR8L hujp4bC+cYiEMiAbA2ggffw+1Gjp/DAclVeLmtC+atXKoLRbwb+M0UXoyDeIIr90 X-Gm-Gg: ASbGncs/bwsKkf5DuzSj4KZfYehHw7aNRbbrAkZlDQFsrk1VrXbMGZ4NpRzV/4pBhGm lipIOMHvz4fn169KH23A4dn+1n919o6GS593BeWUpoEOKnF82Dv8EeeEgCEwnCOKtg0RGGi6nyr CSkXC4YVSyZAOiHrZ1L9hzfmFWzuSeFIPe3Vj504701YLHD7HnYOy2JnXlJcEfQc8NWjb5sApIG s1/b6/aq44WGqq8lPqa3RTcM0jAJv+m1Dzitw85Udl46CwQZFPS4Kupo2vlOWB6fr1qQM6CKwDS hVKM9o2XxUtQQ5pvsZQ/xA6H3pEI74gOF9IDzKbnyRun+NN8adiQ+374o5/+NY5jTjOG9U5cbF5 lfoqxmZr0XbTO5Jr+5qtFwqL4/DkokumHoSCmZZ+A8TA8oS6Lklk36KP5ENdKCaRbY17q3+eNrT 4WhXGUfeG2dsvtw/prLDvqqw== X-Google-Smtp-Source: AGHT+IG6n6aFGbUSrsHSAh0aU46l2diUOlWIJm35CRQ1UhDTmou18GJKCwrhit53VyT1kWPxPp8SOg== X-Received: by 2002:a05:600c:3e15:b0:442:fff5:5185 with SMTP id 5b1f17b1804b1-4589e8745e9mr8944225e9.6.1753954088600; Thu, 31 Jul 2025 02:28:08 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , Anthony PERARD , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Shawn Anastasio , Alistair Francis , Bob Eshleman , Connor Davis , Oleksii Kurochko , Tamas K Lengyel , Alexandru Isaila , Petre Pircalabu Subject: [PATCH v12 1/6] altp2m: Drop p2m_altp2m_check() stubs on non-x86, move prototype, and guard uses Date: Thu, 31 Jul 2025 09:27:56 +0000 Message-Id: <44b4b60854cd7db6d529ff23bb228e9ac19a2a75.1753953832.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1753954107135116600 From: Petr Bene=C5=A1 Remove the no=E2=80=91op stubs from the ARM, PPC, and RISC=E2=80=91V p2m he= aders and stop providing a stub in arch/x86/include/asm/p2m.h. Declare p2m_altp2m_check() in xen/include/xen/p2m-common.h and gate all call sites with CONFIG_ALTP2M: - wrap the fast_single_step block in hvm/monitor.c with #ifdef CONFIG_ALTP= 2M (IS_ENABLED(CONFIG_ALTP2M) is not used here, because in the subsequent c= ommit hvm_vcpu::fast_single_step will be guarded by CONFIG_ALTP2M) - make the vm_event.c path conditional via IS_ENABLED(CONFIG_ALTP2M) No functional change intended: on builds without ALTP2M the calls are compiled out; on builds with ALTP2M behavior is unchanged. Signed-off-by: Petr Bene=C5=A1 Reviewed-by: Jan Beulich Acked-by: Julien Grall # arm Acked-by: Tamas K Lengyel --- xen/arch/arm/include/asm/p2m.h | 6 ------ xen/arch/ppc/include/asm/p2m.h | 5 ----- xen/arch/riscv/include/asm/p2m.h | 5 ----- xen/arch/x86/hvm/monitor.c | 2 ++ xen/arch/x86/include/asm/p2m.h | 8 +------- xen/common/vm_event.c | 3 ++- xen/include/xen/p2m-common.h | 3 +++ 7 files changed, 8 insertions(+), 24 deletions(-) diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h index 2d53bf9b61..ef98bc5f4d 100644 --- a/xen/arch/arm/include/asm/p2m.h +++ b/xen/arch/arm/include/asm/p2m.h @@ -180,12 +180,6 @@ static inline bool arch_acquire_resource_check(struct = domain *d) return true; } =20 -static inline -void p2m_altp2m_check(struct vcpu *v, uint16_t idx) -{ - /* Not supported on ARM. */ -} - /* * Helper to restrict "p2m_ipa_bits" according the external entity * (e.g. IOMMU) requirements. diff --git a/xen/arch/ppc/include/asm/p2m.h b/xen/arch/ppc/include/asm/p2m.h index f144ef8e1a..c96149ef74 100644 --- a/xen/arch/ppc/include/asm/p2m.h +++ b/xen/arch/ppc/include/asm/p2m.h @@ -88,9 +88,4 @@ static inline bool arch_acquire_resource_check(struct dom= ain *d) return false; } =20 -static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx) -{ - /* Not supported on PPC. */ -} - #endif /* __ASM_PPC_P2M_H__ */ diff --git a/xen/arch/riscv/include/asm/p2m.h b/xen/arch/riscv/include/asm/= p2m.h index 28f57a74f2..e43c559e0c 100644 --- a/xen/arch/riscv/include/asm/p2m.h +++ b/xen/arch/riscv/include/asm/p2m.h @@ -88,11 +88,6 @@ static inline bool arch_acquire_resource_check(struct do= main *d) return false; } =20 -static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx) -{ - /* Not supported on RISCV. */ -} - #endif /* ASM__RISCV__P2M_H */ =20 /* diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c index 523586ca98..d22a2e4644 100644 --- a/xen/arch/x86/hvm/monitor.c +++ b/xen/arch/x86/hvm/monitor.c @@ -178,6 +178,7 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monit= or_debug_type type, break; =20 case HVM_MONITOR_SINGLESTEP_BREAKPOINT: +#ifdef CONFIG_ALTP2M if ( curr->arch.hvm.fast_single_step.enabled ) { p2m_altp2m_check(curr, curr->arch.hvm.fast_single_step.p2midx); @@ -186,6 +187,7 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monit= or_debug_type type, curr->arch.hvm.fast_single_step.p2midx =3D 0; return 0; } +#endif if ( !ad->monitor.singlestep_enabled ) return 0; req.reason =3D VM_EVENT_REASON_SINGLESTEP; diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h index 58b56e575e..c53f4e487d 100644 --- a/xen/arch/x86/include/asm/p2m.h +++ b/xen/arch/x86/include/asm/p2m.h @@ -962,17 +962,11 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn= _t gfn, /* Set a specific p2m view visibility */ int p2m_set_altp2m_view_visibility(struct domain *d, unsigned int altp2m_i= dx, uint8_t visible); + #else /* !CONFIG_HVM */ struct p2m_domain *p2m_get_altp2m(struct vcpu *v); #endif /* CONFIG_HVM */ =20 -#ifdef CONFIG_ALTP2M -/* Check to see if vcpu should be switched to a different p2m. */ -void p2m_altp2m_check(struct vcpu *v, uint16_t idx); -#else -static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx) {} -#endif - /* p2m access to IOMMU flags */ static inline unsigned int p2m_access_to_iommu_flags(p2m_access_t p2ma) { diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c index 1666ff615f..b2787c0108 100644 --- a/xen/common/vm_event.c +++ b/xen/common/vm_event.c @@ -431,7 +431,8 @@ static int vm_event_resume(struct domain *d, struct vm_= event_domain *ved) vm_event_toggle_singlestep(d, v, &rsp); =20 /* Check for altp2m switch */ - if ( rsp.flags & VM_EVENT_FLAG_ALTERNATE_P2M ) + if ( IS_ENABLED(CONFIG_ALTP2M) && + rsp.flags & VM_EVENT_FLAG_ALTERNATE_P2M ) p2m_altp2m_check(v, rsp.altp2m_idx); =20 if ( rsp.flags & VM_EVENT_FLAG_SET_REGISTERS ) diff --git a/xen/include/xen/p2m-common.h b/xen/include/xen/p2m-common.h index a322e738ef..f0bd9a6b98 100644 --- a/xen/include/xen/p2m-common.h +++ b/xen/include/xen/p2m-common.h @@ -24,6 +24,9 @@ int unmap_mmio_regions(struct domain *d, unsigned long nr, mfn_t mfn); =20 +/* Check to see if vcpu should be switched to a different p2m. */ +void p2m_altp2m_check(struct vcpu *v, uint16_t idx); + /* * Populate-on-Demand */ --=20 2.34.1