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 C5330ECE564 for ; Tue, 10 Sep 2024 04:27:14 +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=u/+FRQQ8Ru8+M5tm0CToElnSS7luR16tiIP4Dg8B3y8=; b=H4KdE0gWji3OkKY2/lpnSxDxBg aI6GS/Fogg7C6tioK3iF/xbdTEe44gLRGgeAv3G9VKew9epUYq+8/weTak/rzLtkuN3RYAd/ROIxK Zz2EYAaPZDxiHPopv9bChnpHRTJwM0XTcOmGGbJxlq4Sooq9Wb+JbuejPCIXO8+cciVMb/jOkdhxg COD8L0rto9tPeRUMg6ngG/J4r6yHGV3GSVlP3/jrY7HnsV26A8Rxv85MhZ4dNfYCFbYsQqmRuWVmG BtyEta6qnojvKQdPP+YwLSNR7Agw1XpYM1vXhaHvDK3zDmowtK/VFUCwNMYyQvTEXlYQkwUTtH0w3 ej3pX1hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snsT2-00000004Cp4-33tN; Tue, 10 Sep 2024 04:27:04 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1snsID-000000049y6-2sEE for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 04:15:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725941752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u/+FRQQ8Ru8+M5tm0CToElnSS7luR16tiIP4Dg8B3y8=; b=dqWdq0/SMJnTpdZNVVG3YYLM2yKiE4Uujv0Lx7TJsxW/Fj+Gx0FVNPzeKjZ39nGzzRt8WT Fr5S/rO9ITSDEzjFAPYaDFTlpMPUfFdw50rP12VtlE79Pocor+PBug2qT1R8IqwQHqye9W W5PdGKvODRrTM7YCml59ZwQvg8tl9ug= Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-JK11mBKFMR-6M3P0Z9PFdg-1; Tue, 10 Sep 2024 00:15:51 -0400 X-MC-Unique: JK11mBKFMR-6M3P0Z9PFdg-1 Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-7d50777abf1so2931588a12.3 for ; Mon, 09 Sep 2024 21:15:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725941749; x=1726546549; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u/+FRQQ8Ru8+M5tm0CToElnSS7luR16tiIP4Dg8B3y8=; b=VTIKklkemGIl1Oerz8COkXbWjp1yIQichBd8XgJvBp2/PVOFAqte9vEKiMOqwXVmP4 d5AwovpxvICSiFVil5JrF9f939tfjXiHA9DDO+6mnZxrZTakJD+8NtvGV6JA1EFpsuug Q4/LRO2oQhIHTVmydZjGFqpOpngOsKAjFfXAh1Hs/a51Fb+O0OyYxUboPOQrqyr6yqah Io21jTsEtroQsEaljtqW1UhUgdOKV5gT3hPNEFjFaLAMIcu06rILLFN9Escl8S7Gj7bE VxdawbP2eiRVd9wdSGfkwJ2mRY5is0/FlyTYNobz90qEffqqANjrgNencU6XvWo2AXcd Vd0w== X-Forwarded-Encrypted: i=1; AJvYcCXefL7uBYxvVoq+5XxvpxTSf8JFV9SvFky2X/zf07Bj4E1sMN1wOdTZ4lbPEPfKhdfQmqB3aZ8irm6vxJ0zT65Y@lists.infradead.org X-Gm-Message-State: AOJu0YzNbTxhm8wOyHkE3cFkTPZ4LYtXjxlQLXz3OjO7IyQC0SZAq04k dkh4Y04RQaY/YVRtqxnUQYNw9VPfHizT5eEvXB2HNz1hCNwj9OpLmh7R8y3otia7Kj9L/BdxkFw 6qRN2VBMHA+sVXfGi0DFsAwPt/Xwq/q19GNd/7cX23hvltsEM9Xl6sNgxiaNCxLOGBpgXxNYBCc B+bL0P X-Received: by 2002:a17:902:f549:b0:202:5af:47fc with SMTP id d9443c01a7336-206f0511f66mr213103825ad.13.1725941749254; Mon, 09 Sep 2024 21:15:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESpzFJPvUaYPPTKHz8T4YHLbc03zqgmBJU6sgzN1/EtRPQmV6cfuytRj9V1iBRvh9wsUVF0g== X-Received: by 2002:a17:902:f549:b0:202:5af:47fc with SMTP id d9443c01a7336-206f0511f66mr213103255ad.13.1725941748534; Mon, 09 Sep 2024 21:15:48 -0700 (PDT) Received: from [192.168.68.54] ([103.210.27.31]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710e0efbesm40682855ad.40.2024.09.09.21.15.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Sep 2024 21:15:48 -0700 (PDT) Message-ID: <29016e56-e632-422d-a4d2-1891fad2c565@redhat.com> Date: Tue, 10 Sep 2024 14:15:39 +1000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 12/19] efi: arm64: Map Device with Prot Shared To: Steven Price , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , 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 , Shanker Donthineni , Alper Gun References: <20240819131924.372366-1-steven.price@arm.com> <20240819131924.372366-13-steven.price@arm.com> From: Gavin Shan In-Reply-To: <20240819131924.372366-13-steven.price@arm.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US 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-20240909_211553_953654_EBEE358A X-CRM114-Status: GOOD ( 19.69 ) 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 8/19/24 11:19 PM, Steven Price wrote: > From: Suzuki K Poulose > > Device mappings need to be emualted by the VMM so must be mapped shared > with the host. > > Signed-off-by: Suzuki K Poulose > Signed-off-by: Steven Price > --- > Changes since v4: > * Reworked to use arm64_is_iomem_private() to decide whether the memory > needs to be decrypted or not. > --- > arch/arm64/kernel/efi.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c > index 712718aed5dd..95f8e8bf07f8 100644 > --- a/arch/arm64/kernel/efi.c > +++ b/arch/arm64/kernel/efi.c > @@ -34,8 +34,16 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md) > u64 attr = md->attribute; > u32 type = md->type; > > - if (type == EFI_MEMORY_MAPPED_IO) > - return PROT_DEVICE_nGnRE; > + if (type == EFI_MEMORY_MAPPED_IO) { > + pgprot_t prot = __pgprot(PROT_DEVICE_nGnRE); > + > + if (arm64_is_iomem_private(md->phys_addr, > + md->num_pages << EFI_PAGE_SHIFT)) > + prot = pgprot_encrypted(prot); > + else > + prot = pgprot_decrypted(prot); > + return pgprot_val(prot); > + } > Question: the second parameter (@size) passed to arm64_is_iomem_private() covers the whole region. In [PATCH v5 10/19] arm64: Override set_fixmap_io, the size has been truncated to the granule size (4KB). They look inconsistent and I don't understand the reason. Thanks, Gavin