From nobody Sat Apr 4 04:35:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B4282D5A19 for ; Sat, 21 Mar 2026 00:10:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774051821; cv=none; b=ptXHvTyZ1gbcb5D+Eo/PK79IFM1uL5J3pH0dmU0Zu7+omMVed/ue+ewRb7S2i1ieDySP5Q4ErER6aXhzrRxpmdD71BYVjMoahgu/xYGvaFQpxvQMbwlAl/FDIpgOPGzEQGVuq27beKRIOQ64uBE95JLhi2A1pF2WjASOlk8VCKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774051821; c=relaxed/simple; bh=qpfSwESFLIlwjcqgqHf3Mzr6+Jhapyh4n2GkzBzAjXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rR1aQ2hGCJD8u3LXfeqx+xb6PJLfiIfI2x8p2QNjfN2e3XZWafp22myQXROLiU97KwS/dYQaltMPnq5gYB5/+B6OWFIEno0aO9fEQpKMrNIyOyMepX7dpQpmkJk6tW5NYpETTwCSRDkefDU2jGHlj6bH0CuTRoOyBJ1jbJgXYAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UUm0gcxB; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=oTcrW4Ne; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UUm0gcxB"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="oTcrW4Ne" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774051819; 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=Jg9FJYTi3ipQ4IiFmY2Dnx6hNOGPYdEpeaX3QtXeZQY=; b=UUm0gcxBma38e2VUwKaClK0UG4Es5u4VqXueSfKlKPYiripYbU3GOGK7UfuPb9/H5uyD5w ggrSyoJ+L22LckwgDRliftEZTI7OOB3YhmFZU+JydBpj1umFdgLd42azPAyJLjNlYa/Ej8 g6KTbkAiZbJU7aniO8Bl2m/DGRvgn+c= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-qflySqzUN3CQo2X4dOVTPg-1; Fri, 20 Mar 2026 20:10:18 -0400 X-MC-Unique: qflySqzUN3CQo2X4dOVTPg-1 X-Mimecast-MFC-AGG-ID: qflySqzUN3CQo2X4dOVTPg_1774051817 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-486fb142205so17987395e9.1 for ; Fri, 20 Mar 2026 17:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1774051816; x=1774656616; darn=vger.kernel.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=Jg9FJYTi3ipQ4IiFmY2Dnx6hNOGPYdEpeaX3QtXeZQY=; b=oTcrW4NeEqcTwSvUPYepmNaJFefveX/0UGJw+GAapAfdFpbQhLCzy48ByHirvAZP79 EzmNlRejyu+1brtECNfg1nnKsD5aWmnpFUTfr+tBAlTenvsK+DJwjBfQOvv7ptWBVKKM 9STAxTt2HEP0858Vw6FTE3V5GIcz87FmxqPGmjP0LF+BWno7tntn/AgjTlzDakdHtfkz akTqmIXit1EdPcCKKmlOE+0mu8swm6yAhkSOokDnY0cqvG8s3k7gALweAxTe0ScC0L8l 4v/qs/copDr8Vc+UjOJeC4JJj+6H18ayK2ki5no0VLzoM0VYS+4AWf8MzaVdFcyznmLe 5anA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774051816; x=1774656616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Jg9FJYTi3ipQ4IiFmY2Dnx6hNOGPYdEpeaX3QtXeZQY=; b=TRZ4vWqCjDC7rgTom26GscECi+AcznvSL/T7RfWDFxHM5pwCDPV4lSU0C2y3wadWOJ 0peTt13GNlTDyQ8mMZ98c/503cj6cJQvPaiQgype4u2dT3QswCXMuu4mwWA941e+xUuX GULtC0zvcwiPDGcEKjQef/3s4HD7psxt/MCVKqVyOzjdO0ImS8mzU9xqSEe1CTzJhlOl IM6GrTzuPMYYOLbIiFr+lxsM35270IsD2pfqGBSwo+JD94BXa/VTfJTf2GmTJ+tC+sVj xrRhuNDCc9QLa2CdibCTLuCv39iux6qT/0Aj5BkR7utugiOXYvBQrcBb4NkU1wEzL7Pd BmTw== X-Gm-Message-State: AOJu0YzWja4X3s/DlDWuZbtV3KTCmh932mx/3KcPFeWETj06tevkbZPv vFjzK7cZnvVaY60/fr253rhI/TNLve0+TZpbCpbuHw32Tjs8Aqa2xQt5upbSEymJ1u5zI0bF1bM XkePmEkCJZyjPaJ3YxkeF3YPWeejit4I5DfZlilM5SQCqoobyI9S3SSKGMcxlnC+XFIHhcsvvvR v7Eo4t22RcMZvtuKgpcV4JHbC1LxCO1LDK5LLlgCTPepNAaVYMdQ== X-Gm-Gg: ATEYQzxbPkcKumulOZAmVeo8Xwx0jzV+1KEptIeoIrJXz7GV3EYcQQrhgYEWFHHEAAT NvCt4fpM0RHZc4I7bCc7hR6Cj/4wTLGoes4HqrulnBMmIgEvvmFaymCfWkVeztCXVJb8jVBiRJp dxljkTjbhlpvrVCdPSr8FMQQekc+iLA7zGV449b1WUdVsvQtlHBVKprNhstTab+6jpx5P4HAVyC xMJNBZcHUBEriRQZ/dp62Jk8OjukM3sr52ZdcLdbjZG9ZYPNW6sYsdtNnsyjZMP7UCLMsGeobQZ kcO3MvgZSK3Hzdb6dcufZj3/KytmJF8kQEAM8PmagYNEVHaKn7o6yuu3muHlPmArUihkpvJt9ad JoajVmLsmWcs8BDd9o8GO8nq7JSgX65wqFK5tBYB7uYahptrs/+Cf3vG7JzViZw9adayGXqfxpy wx7sittshs+m1gCGdYlA/mWv/X X-Received: by 2002:a05:600c:1f86:b0:480:1d0b:2d32 with SMTP id 5b1f17b1804b1-486fedb5916mr75347575e9.12.1774051816416; Fri, 20 Mar 2026 17:10:16 -0700 (PDT) X-Received: by 2002:a05:600c:1f86:b0:480:1d0b:2d32 with SMTP id 5b1f17b1804b1-486fedb5916mr75347245e9.12.1774051815938; Fri, 20 Mar 2026 17:10:15 -0700 (PDT) Received: from [192.168.10.48] ([151.49.85.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-486fe8367d8sm121266625e9.14.2026.03.20.17.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 17:10:13 -0700 (PDT) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Jon Kohler , Marcelo Tosatti , Nikunj A Dadhania , Amit Shah , Sean Christopherson Subject: [PATCH 16/22] KVM: x86/tdp_mmu: propagate access mask from kvm_mmu_page to PTE Date: Sat, 21 Mar 2026 01:09:25 +0100 Message-ID: <20260321000931.1947084-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260321000931.1947084-1-pbonzini@redhat.com> References: <20260321000931.1947084-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Until now, all SPTEs have had all kinds of access allowed; however, for GMET to be enabled all the pages have to have ACC_USER_MASK disabled. By marking them as supervisor pages, the processor allows execution from either user or supervisor mode (unlike for normal paging, NPT ignores the U bit for reads and writes). That will mean that the root page's role has ACC_USER_MASK cleared and that has to be propagated down through the TDP MMU pages. Do that in tdp_mmu_map_handle_target_level. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/mmu/tdp_mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index 7f3d7229b2c1..f0e7528435cf 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -1161,9 +1161,9 @@ static int tdp_mmu_map_handle_target_level(struct kvm= _vcpu *vcpu, } =20 if (unlikely(!fault->slot)) - new_spte =3D make_mmio_spte(vcpu, iter->gfn, ACC_ALL); + new_spte =3D make_mmio_spte(vcpu, iter->gfn, sp->role.access); else - wrprot =3D make_spte(vcpu, sp, fault->slot, ACC_ALL, iter->gfn, + wrprot =3D make_spte(vcpu, sp, fault->slot, sp->role.access, iter->gfn, fault->pfn, iter->old_spte, fault->prefetch, false, fault->map_writable, &new_spte); =20 --=20 2.52.0