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 X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36681C07E95 for ; Tue, 20 Jul 2021 11:16:29 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id AF45461165 for ; Tue, 20 Jul 2021 11:16:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF45461165 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3C6344A531; Tue, 20 Jul 2021 07:16:28 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4dhEzS3-MZtU; Tue, 20 Jul 2021 07:16:24 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9F8134A95C; Tue, 20 Jul 2021 07:16:24 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 58FED4A193 for ; Tue, 20 Jul 2021 07:16:23 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QiI6Zy5QQgJ1 for ; Tue, 20 Jul 2021 07:16:22 -0400 (EDT) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 4AC0440808 for ; Tue, 20 Jul 2021 07:16:22 -0400 (EDT) Received: by mail-wr1-f42.google.com with SMTP id l7so25561691wrv.7 for ; Tue, 20 Jul 2021 04:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lpz51H3kvzr0DXJiE5RSxJNphxVtTP/JsLlCDtT69nE=; b=qIC8S+W4YEqX+/j1F2FfOOKMPB60fsBSS7jpd0cT0fUpSNivYVwV9Lc7AMV3WoXmMw v9CgSh/vI2qWbAPurBZw5TN+KhWhe340MqIv4ApDr2YkuHg+Csl3bWm9i8QeClaaikDF uMaiwpDXgtAjXyOpfnmR2iYIblGFLYIY3j+yTDSwccOVQiIL8S3kXlqDClfWK41H+kgw kmra3575DBZwkejSgK4e4RWzFoz1f0sOdv7uO07ytjh1dww1naA5hdZhhZFRFHVDi3Yj hQdxBPLQFqiPS5CCQ0OE+yh0ewTntdOyy+voxTzTeMDdMan7IlXYk0lQLYB1dMXeHg6A /60Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lpz51H3kvzr0DXJiE5RSxJNphxVtTP/JsLlCDtT69nE=; b=qH9L5V6J7uup0596RzOS7kHHT5Urt0EDn/ZYQCRQfPemLWDLWTe+v9OE1UEF2/jvgW r9iMUC3rYp+Ncvnv+BKtQNq/KL6ZutDlDKZ6NdWVWTw40HPJmvcOvJjcVvFu0nsmXfsK X3RscXawwAn8/nWlTEXmWddlxde4lXS8uYOBzsAdp6ULwYvXB76ZcDKiEeozyIW0gFoB qvEQ7TiiBN1A4M1idPlUi8icgYq29ttJAf3Dqpa1IIFms/lz8HsMRGso5z55W5oYOuBR n4haezGd9ge2Yat4z7skNdeI2qfB3ICSZ6rmsKw9RG8INWzQVlb/4WekKE+wmuP6AKL1 stqQ== X-Gm-Message-State: AOAM533MEJixE9b90YNi4bVROHDUCfFHuCOkFr9UTriPPw7j/VboVEsD XDwPDutBlDLiJb0pNHYiLn/vYA== X-Google-Smtp-Source: ABdhPJzyDbPtX+5Q7MPnRmTCUDtOQw0hbyz28e4E5BQ9dsfjysvHdxUpebOfYRKz9mVC05s+yeb7VQ== X-Received: by 2002:a05:6000:102:: with SMTP id o2mr35120793wrx.299.1626779781184; Tue, 20 Jul 2021 04:16:21 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:83e0:11ac:c870:2b97]) by smtp.gmail.com with ESMTPSA id a8sm23462978wrt.61.2021.07.20.04.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 04:16:20 -0700 (PDT) Date: Tue, 20 Jul 2021 12:16:17 +0100 From: Quentin Perret To: Marc Zyngier Subject: Re: [PATCH 15/16] arm64: Add a helper to retrieve the PTE of a fixmap Message-ID: References: <20210715163159.1480168-1-maz@kernel.org> <20210715163159.1480168-16-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210715163159.1480168-16-maz@kernel.org> Cc: kernel-team@android.com, kvm@vger.kernel.org, Srivatsa Vaddagiri , linux-kernel@vger.kernel.org, Shanker R Donthineni , will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Thursday 15 Jul 2021 at 17:31:58 (+0100), Marc Zyngier wrote: > In order to transfer the early mapping state into KVM's MMIO > guard infrastucture, provide a small helper that will retrieve > the associated PTE. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/include/asm/fixmap.h | 2 ++ > arch/arm64/mm/mmu.c | 15 +++++++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/arch/arm64/include/asm/fixmap.h b/arch/arm64/include/asm/fixmap.h > index 4335800201c9..1aae625b944f 100644 > --- a/arch/arm64/include/asm/fixmap.h > +++ b/arch/arm64/include/asm/fixmap.h > @@ -105,6 +105,8 @@ void __init early_fixmap_init(void); > > extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); > > +extern pte_t *__get_fixmap_pte(enum fixed_addresses idx); > + > #include > > #endif /* !__ASSEMBLY__ */ > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index d74586508448..f1b7abd04025 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1286,6 +1286,21 @@ void __set_fixmap(enum fixed_addresses idx, > } > } > > +pte_t *__get_fixmap_pte(enum fixed_addresses idx) > +{ > + unsigned long addr = __fix_to_virt(idx); Nit: odd spacing here. > + pte_t *ptep; > + > + BUG_ON(idx <= FIX_HOLE || idx >= __end_of_fixed_addresses); > + > + ptep = fixmap_pte(addr); > + > + if (!pte_valid(*ptep)) > + return NULL; > + > + return ptep; > +} > + > void *__init fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot) > { > const u64 dt_virt_base = __fix_to_virt(FIX_FDT); > -- > 2.30.2 > _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BAD9C07E95 for ; Tue, 20 Jul 2021 11:18:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C5CC66023D for ; Tue, 20 Jul 2021 11:18:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5CC66023D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cKpydAWXXEySAlFsek3CmM2kstFVvtKnfNQq1KGCm8g=; b=rC0X84ABxXiozE XN5WWRb8Zovsj2I9aA+O/z6aK4IxSw/Bmh+nD53EJacwvlidHisF0TKKUAdoH2HJXmMfcfxx6xS97 VBpM8LciZvnFzETNHXHIlfxf33OURfFAMLQDlhpKCTn6PPTu3cmA728WItRg6P1CSVY9nQNzl16V/ RVegyMrIITVuvvum4ZqGcITqJvZ8MwNiJJZXB7DxkWZuCLgP6iYPVqKlKlk5JygbK3AcZy+oVGMVP 0fU8AEc2FEnqVX05WvlCDd39LfvjrhWyRb5GYIVD0iMt1k0ilodKQ+T2KjkB4qEi+gilscg7Y4pTV gDGaU3Mbt5mtL5DH2lnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5njg-00Ccfz-1r; Tue, 20 Jul 2021 11:16:28 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5nja-00Ccdr-MQ for linux-arm-kernel@lists.infradead.org; Tue, 20 Jul 2021 11:16:24 +0000 Received: by mail-wr1-x431.google.com with SMTP id t5so25539839wrw.12 for ; Tue, 20 Jul 2021 04:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lpz51H3kvzr0DXJiE5RSxJNphxVtTP/JsLlCDtT69nE=; b=qIC8S+W4YEqX+/j1F2FfOOKMPB60fsBSS7jpd0cT0fUpSNivYVwV9Lc7AMV3WoXmMw v9CgSh/vI2qWbAPurBZw5TN+KhWhe340MqIv4ApDr2YkuHg+Csl3bWm9i8QeClaaikDF uMaiwpDXgtAjXyOpfnmR2iYIblGFLYIY3j+yTDSwccOVQiIL8S3kXlqDClfWK41H+kgw kmra3575DBZwkejSgK4e4RWzFoz1f0sOdv7uO07ytjh1dww1naA5hdZhhZFRFHVDi3Yj hQdxBPLQFqiPS5CCQ0OE+yh0ewTntdOyy+voxTzTeMDdMan7IlXYk0lQLYB1dMXeHg6A /60Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lpz51H3kvzr0DXJiE5RSxJNphxVtTP/JsLlCDtT69nE=; b=aNzJ2aUgBZD/6Wv69OBJZJYDU4zNAkIpabrxmY9AQG3dxwzRozQH36N3fM36CMLkg4 sgAeHDv3NM7Ax6AkZPkHMhK3nbv4cmiDyzp5Yk82hoKqjP6ngAfv7V+M2gxRRkmtqmF4 bZKJ8q3NflRBC+DGNBl6BiBSuxYJs7VPjYlXgih/qmyjw9v2B6Mjj44f1NGzNLrOHFgv 9XNgNPA75a3FLdnJsqoEdcLyxH1xEhHYX77BLISP+1FE/ovfoR/uaQvhAgv947ESo/Jn 5XmHRzPtGY7wra8WTTe+lKEaKfARj5UVq6xr5YherM9SC/qV1visGFOpQIZGZ5OFgIqe bV0Q== X-Gm-Message-State: AOAM530aZzrp9NdItCuAT/ahniwZw/Ujp9JNtLkhQjTRxp8pFMFs2+Ei HWN/DkhYD0NNMYEDYciU6quyCA== X-Google-Smtp-Source: ABdhPJzyDbPtX+5Q7MPnRmTCUDtOQw0hbyz28e4E5BQ9dsfjysvHdxUpebOfYRKz9mVC05s+yeb7VQ== X-Received: by 2002:a05:6000:102:: with SMTP id o2mr35120793wrx.299.1626779781184; Tue, 20 Jul 2021 04:16:21 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:83e0:11ac:c870:2b97]) by smtp.gmail.com with ESMTPSA id a8sm23462978wrt.61.2021.07.20.04.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 04:16:20 -0700 (PDT) Date: Tue, 20 Jul 2021 12:16:17 +0100 From: Quentin Perret To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, will@kernel.org, dbrazdil@google.com, Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH 15/16] arm64: Add a helper to retrieve the PTE of a fixmap Message-ID: References: <20210715163159.1480168-1-maz@kernel.org> <20210715163159.1480168-16-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210715163159.1480168-16-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210720_041622_798516_814FF05C X-CRM114-Status: GOOD ( 18.21 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thursday 15 Jul 2021 at 17:31:58 (+0100), Marc Zyngier wrote: > In order to transfer the early mapping state into KVM's MMIO > guard infrastucture, provide a small helper that will retrieve > the associated PTE. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/include/asm/fixmap.h | 2 ++ > arch/arm64/mm/mmu.c | 15 +++++++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/arch/arm64/include/asm/fixmap.h b/arch/arm64/include/asm/fixmap.h > index 4335800201c9..1aae625b944f 100644 > --- a/arch/arm64/include/asm/fixmap.h > +++ b/arch/arm64/include/asm/fixmap.h > @@ -105,6 +105,8 @@ void __init early_fixmap_init(void); > > extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); > > +extern pte_t *__get_fixmap_pte(enum fixed_addresses idx); > + > #include > > #endif /* !__ASSEMBLY__ */ > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index d74586508448..f1b7abd04025 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1286,6 +1286,21 @@ void __set_fixmap(enum fixed_addresses idx, > } > } > > +pte_t *__get_fixmap_pte(enum fixed_addresses idx) > +{ > + unsigned long addr = __fix_to_virt(idx); Nit: odd spacing here. > + pte_t *ptep; > + > + BUG_ON(idx <= FIX_HOLE || idx >= __end_of_fixed_addresses); > + > + ptep = fixmap_pte(addr); > + > + if (!pte_valid(*ptep)) > + return NULL; > + > + return ptep; > +} > + > void *__init fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot) > { > const u64 dt_virt_base = __fix_to_virt(FIX_FDT); > -- > 2.30.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 X-Spam-Level: X-Spam-Status: No, score=-20.8 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BD81C07E95 for ; Tue, 20 Jul 2021 11:17:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 078BA61165 for ; Tue, 20 Jul 2021 11:17:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236425AbhGTKg3 (ORCPT ); Tue, 20 Jul 2021 06:36:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237160AbhGTKfq (ORCPT ); Tue, 20 Jul 2021 06:35:46 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA16FC061762 for ; Tue, 20 Jul 2021 04:16:22 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id i94so25571451wri.4 for ; Tue, 20 Jul 2021 04:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lpz51H3kvzr0DXJiE5RSxJNphxVtTP/JsLlCDtT69nE=; b=qIC8S+W4YEqX+/j1F2FfOOKMPB60fsBSS7jpd0cT0fUpSNivYVwV9Lc7AMV3WoXmMw v9CgSh/vI2qWbAPurBZw5TN+KhWhe340MqIv4ApDr2YkuHg+Csl3bWm9i8QeClaaikDF uMaiwpDXgtAjXyOpfnmR2iYIblGFLYIY3j+yTDSwccOVQiIL8S3kXlqDClfWK41H+kgw kmra3575DBZwkejSgK4e4RWzFoz1f0sOdv7uO07ytjh1dww1naA5hdZhhZFRFHVDi3Yj hQdxBPLQFqiPS5CCQ0OE+yh0ewTntdOyy+voxTzTeMDdMan7IlXYk0lQLYB1dMXeHg6A /60Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lpz51H3kvzr0DXJiE5RSxJNphxVtTP/JsLlCDtT69nE=; b=WbI9qsvHs2lMC+joS16PTOfWBnWhlXJtPyuAZuI902aGt9og9FdGaLmft/9diLfCxq fJTSA0MEMTaaqmMkJM20Z4kaJClFGFfxIW1mJSg5yivEwiMPk+HzGfQC4Z3Wt0ELF3GZ +cTVu12RLdz/yUZw/HjLuYXUm06EFSDFptFce9iQXlhVrogCmtRHcDZ8LAr3ObeMqoh3 S9TeyLFr0+wjCe6piEn6Man9bP+CTOiP1bMbAIMVxJL6tWOWqOS4uXH3Ua1U795p2GDy SBuqmo/N86td6bnW5gymst8cJzpVD3pdIkrEON4qcEWgMgknojY/RkKnMoNFxGRi/a/H MUJQ== X-Gm-Message-State: AOAM5333KYLANAcWLRx7OuoPoCE/zzyuj3SphgRxksMaVOMpbvR2GYyg XnbJBv9p/8CjZuOPblgrXrZXrg== X-Google-Smtp-Source: ABdhPJzyDbPtX+5Q7MPnRmTCUDtOQw0hbyz28e4E5BQ9dsfjysvHdxUpebOfYRKz9mVC05s+yeb7VQ== X-Received: by 2002:a05:6000:102:: with SMTP id o2mr35120793wrx.299.1626779781184; Tue, 20 Jul 2021 04:16:21 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:83e0:11ac:c870:2b97]) by smtp.gmail.com with ESMTPSA id a8sm23462978wrt.61.2021.07.20.04.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 04:16:20 -0700 (PDT) Date: Tue, 20 Jul 2021 12:16:17 +0100 From: Quentin Perret To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, will@kernel.org, dbrazdil@google.com, Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH 15/16] arm64: Add a helper to retrieve the PTE of a fixmap Message-ID: References: <20210715163159.1480168-1-maz@kernel.org> <20210715163159.1480168-16-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715163159.1480168-16-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thursday 15 Jul 2021 at 17:31:58 (+0100), Marc Zyngier wrote: > In order to transfer the early mapping state into KVM's MMIO > guard infrastucture, provide a small helper that will retrieve > the associated PTE. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/include/asm/fixmap.h | 2 ++ > arch/arm64/mm/mmu.c | 15 +++++++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/arch/arm64/include/asm/fixmap.h b/arch/arm64/include/asm/fixmap.h > index 4335800201c9..1aae625b944f 100644 > --- a/arch/arm64/include/asm/fixmap.h > +++ b/arch/arm64/include/asm/fixmap.h > @@ -105,6 +105,8 @@ void __init early_fixmap_init(void); > > extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); > > +extern pte_t *__get_fixmap_pte(enum fixed_addresses idx); > + > #include > > #endif /* !__ASSEMBLY__ */ > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index d74586508448..f1b7abd04025 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1286,6 +1286,21 @@ void __set_fixmap(enum fixed_addresses idx, > } > } > > +pte_t *__get_fixmap_pte(enum fixed_addresses idx) > +{ > + unsigned long addr = __fix_to_virt(idx); Nit: odd spacing here. > + pte_t *ptep; > + > + BUG_ON(idx <= FIX_HOLE || idx >= __end_of_fixed_addresses); > + > + ptep = fixmap_pte(addr); > + > + if (!pte_valid(*ptep)) > + return NULL; > + > + return ptep; > +} > + > void *__init fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot) > { > const u64 dt_virt_base = __fix_to_virt(FIX_FDT); > -- > 2.30.2 >