From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5513FC52D7C for ; Mon, 19 Aug 2024 15:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RE8B6X4ZDxibi7Vzkd7d8MNilmQo0aun1I1kOn77aBI=; b=hGoUczzJjBc8s3FaesT+lnKhc8 nwrSDFvRliCXSCOmoX85Vxiwtko2RyVZZsxK6EGji5V+/07NsfwzM9JzwbfiX3H1ReQG5qqIW3P3/ 5rfQWvpEqo6RdDIHFTqI+p5NJGvVOVSN7F8n5MB3vsn2lDhXBTrWphpAy/KXII+2va2zFbNoku76x Qiw533X+U/kmRgGm6nswendiZtrNbPkVpO0csGbJC3pn6agh/G/zqHgbFp4mL5fdKXAGx3T87vgmf KFZBsRvEWgFBvP2BhwE7RRII6ACel0+zGl4VgxCB9a0pPdtV9KjyAvmrkdt1134h9ahOQ13N4QNTn HDiBETbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg46O-00000001trC-1dAS; Mon, 19 Aug 2024 15:15:24 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg38T-00000001hyN-35RW for linux-arm-kernel@bombadil.infradead.org; Mon, 19 Aug 2024 14:13:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID: Sender:Reply-To:Content-ID:Content-Description; bh=RE8B6X4ZDxibi7Vzkd7d8MNilmQo0aun1I1kOn77aBI=; b=C0Lcbnsx6Xv+mRSX1F4HV2AL/0 U3Uhg0I93iskKqd3YoEh5y90nXg/J7HqfTHbuSiDuFaCOt8aVa+0n4Grzasy/s9Kb5WDzBmmyJ/ZB Ezj+/kbLYPu+R+EgkkJsp6QXjc/Pg5INGVUM9d4hFwXEuKLpTNBF64NW9SVKGdsziVYWAGOwMbrrX 3nxbCAgfr0IrwqEt1TqLY1enMa7vyD6Zpt2RopNeBuRX176w1rBNryCtFNSkyxAr/9WIofwwJf4hB t+7xYBaDu2Nc1p/4/axMH741yEcbYsCu+PWkkYAIlHYtZB8SFB5CIVxqEEsE7gJ5FwvSqdQtNZr6y 8x4YFPpw==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg38P-000000099Yy-2Plx for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2024 14:13:28 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9C37B339; Mon, 19 Aug 2024 07:13:49 -0700 (PDT) Received: from [10.1.36.36] (FVFF763DQ05P.cambridge.arm.com [10.1.36.36]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CD7443F73B; Mon, 19 Aug 2024 07:13:20 -0700 (PDT) Message-ID: <13bc77b7-5f68-44ca-93ce-578ffe029437@arm.com> Date: Mon, 19 Aug 2024 15:13:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 10/19] arm64: Override set_fixmap_io Content-Language: en-GB To: Steven Price , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun References: <20240819131924.372366-1-steven.price@arm.com> <20240819131924.372366-11-steven.price@arm.com> From: Suzuki K Poulose In-Reply-To: <20240819131924.372366-11-steven.price@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240819_151326_923611_50EFB77B X-CRM114-Status: GOOD ( 20.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 19/08/2024 14:19, Steven Price wrote: > From: Suzuki K Poulose > > Override the set_fixmap_io to set shared permission for the host > in case of a CC guest. For now we mark it shared unconditionally. > > If/when support for device assignment and device emulation in the realm > is added in the future then this will need to filter the physical > address and make the decision accordingly. > > Signed-off-by: Suzuki K Poulose > Signed-off-by: Steven Price > --- > New patch for v5 > --- > arch/arm64/include/asm/fixmap.h | 2 ++ > arch/arm64/mm/mmu.c | 17 +++++++++++++++++ > 2 files changed, 19 insertions(+) > > diff --git a/arch/arm64/include/asm/fixmap.h b/arch/arm64/include/asm/fixmap.h > index 87e307804b99..2c20da3a468c 100644 > --- a/arch/arm64/include/asm/fixmap.h > +++ b/arch/arm64/include/asm/fixmap.h > @@ -108,6 +108,8 @@ void __init early_fixmap_init(void); > #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR) > > extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); > +#define set_fixmap_io set_fixmap_io > +void set_fixmap_io(enum fixed_addresses idx, phys_addr_t phys); > > #include > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 353ea5dc32b8..06b66c23c124 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1193,6 +1193,23 @@ void vmemmap_free(unsigned long start, unsigned long end, > } > #endif /* CONFIG_MEMORY_HOTPLUG */ > > +void set_fixmap_io(enum fixed_addresses idx, phys_addr_t phys) > +{ > + pgprot_t prot = FIXMAP_PAGE_IO; > + > + /* > + * The set_fixmap_io maps a single Page covering phys. > + * To make better decision, we stick to the smallest page > + * size supported (4K). > + */ > + if (!arm64_is_iomem_private(phys, SZ_4K)) > + prot = pgprot_decrypted(prot); > + else > + prot = pgprot_encrypted(prot); With the ioremap_prot_hook introduction, this one looks like should use that, instead of open coding the same thing. Thoughts ? Suzuki