From patchwork Mon Aug 9 15:24:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 12426823 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=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT 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 D6154C4338F for ; Mon, 9 Aug 2021 15:34:35 +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 92C4B6101E for ; Mon, 9 Aug 2021 15:34:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 92C4B6101E Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6bL7c1/Fx6X5vCUPSNaZ1CyBx74IH//3JsLFgkG7MRA=; b=p6kq4smMqKSG9+h4fR+uY6VgnW B38Mtqk4uWUHE8w4/Ah2wTmOns313Q2G4VYKlwuHeO6bcXQe46FR9IELVHxMY4gEJkbtRygB+WgGZ SWSwzwAME+zScet8UdDthRHmQyC2N9Gjom/WbETD4bQ+kuwedWt6/JbmFv0t1HwFHzXtEVbFlmAbP wq8BUt/zp3t63UntzonNnQDkRKQlQ/Cih+ZMP3B9zQJ/JFfEYxAZqNZTnt8TjlDNHf0avmoK87zXU w7bUsnzQ55rnvoBFjMGSMt8QjHlAdZ/kFKBDh9WcMkWnWzbLMCoNA42itMJod14R2PC6gR5hSvB1k GOrVBWmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mD7G7-001B4G-4x; Mon, 09 Aug 2021 15:32:12 +0000 Received: from mail-qt1-x849.google.com ([2607:f8b0:4864:20::849]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mD79X-0017ya-AA for linux-arm-kernel@lists.infradead.org; Mon, 09 Aug 2021 15:25:24 +0000 Received: by mail-qt1-x849.google.com with SMTP id c11-20020ac87dcb0000b0290293566e00b1so2063672qte.15 for ; Mon, 09 Aug 2021 08:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=PF2it3NjGIyKq5ORZJDtBzFFsiYhiJLkV2yaXKhO9X4=; b=ftXs+EPnLTaD5rCUC9K5I63oGlpyo8cK1JWBx8UMjZ9M93skpv50giZG25JXZCnqR3 P4/bzs5IMikwsrEoPn4s5CIbKMUP2g9FrdX9jEn37cKvQer2/nFU7JUQGu84PZkYKdGE gpcZQBLTk7tFHRo7TSjmGRlJsxEFHP4XQsoDp4RyZR5TldotXatjcdMTOVVOTTnD+PyE eJg9fO9N/IZNYFbV/fpOFXkoJkn69ctU91Sa2C5RC/VOqM5oXnCCBiwB7oQviBUSERLr uASVreo2KG9expDo8/UU/xVSjkvRLYkgukVyElK5YqFZ7V2OhNzd0/5x5vxtQw21L+ex 2/zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=PF2it3NjGIyKq5ORZJDtBzFFsiYhiJLkV2yaXKhO9X4=; b=eSx7tk2x9ssi6Tg8eSOaUjbskiVlh256+mctcbA1niZsTi1acxi1FsIYjHFUkzqaQQ xm7BzGwIkhtSedFejZQgfQoDmhDmWeVxjPhjsBYili5pvYxZBFUMHN3CCRpA5B10537B zJS+O2dIv2TY42zyv++ai+yS+P1wXB0RXY9R85HKhGcUz09TWn52v9qzH/doezpSDhen HL6kw2Dl5rQvV1Q2h9d20rhLrMzYh3cekSCzyMqzRuaXCrcvDHccZsojSmFxPiChAIQd 2RkW6Wl/Lk3Iuvh4twFzImkLxvrM4vM6aAY7Pn62+RCM2NzvbyHeqz+nOIS0n+3afSCQ qEIA== X-Gm-Message-State: AOAM530Yn4VJUFek/uzNNU+5OzmUzwh5JFGR92zWWP8CxWgSBGJpHmiQ bzFRVJIGTX9QwSRU33vKLhpNnZdYnN51 X-Google-Smtp-Source: ABdhPJykT3ZqBNKwN2TK8pulE0GyjvqWRyK+t1M7X0TDYfKeIo+MjBoUBZPBPTR6JMY1GKpSBOFS/zgqRiv2 X-Received: from luke.lon.corp.google.com ([2a00:79e0:d:210:b0e8:d460:758b:a0ae]) (user=qperret job=sendgmr) by 2002:a05:6214:10e6:: with SMTP id q6mr24439882qvt.11.1628522721784; Mon, 09 Aug 2021 08:25:21 -0700 (PDT) Date: Mon, 9 Aug 2021 16:24:41 +0100 In-Reply-To: <20210809152448.1810400-1-qperret@google.com> Message-Id: <20210809152448.1810400-15-qperret@google.com> Mime-Version: 1.0 References: <20210809152448.1810400-1-qperret@google.com> X-Mailer: git-send-email 2.32.0.605.g8dce9f2422-goog Subject: [PATCH v4 14/21] KVM: arm64: Expose pkvm_hyp_id From: Quentin Perret To: maz@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, ardb@kernel.org, qwandor@google.com, tabba@google.com, dbrazdil@google.com, kernel-team@android.com, qperret@google.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210809_082523_474347_C661C398 X-CRM114-Status: GOOD ( 12.26 ) 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 Allow references to the hypervisor's owner id from outside mem_protect.c. Signed-off-by: Quentin Perret Reviewed-by: Fuad Tabba --- arch/arm64/kvm/hyp/include/nvhe/mem_protect.h | 2 ++ arch/arm64/kvm/hyp/nvhe/mem_protect.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h b/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h index 0849ee8fa260..23316a021880 100644 --- a/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h +++ b/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h @@ -46,6 +46,8 @@ struct host_kvm { }; extern struct host_kvm host_kvm; +extern const u8 pkvm_hyp_id; + int __pkvm_prot_finalize(void); int __pkvm_mark_hyp(phys_addr_t start, phys_addr_t end); diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c index f95a5a4aa09c..ee255171945c 100644 --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c @@ -31,7 +31,7 @@ static struct hyp_pool host_s2_pool; u64 id_aa64mmfr0_el1_sys_val; u64 id_aa64mmfr1_el1_sys_val; -static const u8 pkvm_hyp_id = 1; +const u8 pkvm_hyp_id = 1; static void *host_s2_zalloc_pages_exact(size_t size) {