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=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 A92F7C4361A for ; Fri, 4 Dec 2020 18:03:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 589B622B4E for ; Fri, 4 Dec 2020 18:03:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 589B622B4E 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=X9ryYDOucz1y5DSM3YrJmqUo1+Szc+M8AUCXHJ800HA=; b=GAtiDtnvOqlwhJdJEoqaqf/tc 068DY/ZQeh/Rrxwcfldmn7NUJpwHfONfU1kaE+50TzWR6dx1PWPk3C2VAgqlsTzUCt75b4IMdjRAw 7XuKFQZmdcoUniY1EjvzGbGLwT9Pw/Cknq4fgDTqfR7GKyn2S5tF7upGdOjqXTiYgZgFt51mY7UjY g1wEnGH9ExjrAW6NUOlEys/dC6ldZj7ZCVKqvrrLc88a2HdLqJSBWA//jYD9b21dADKZ0orCbGCYq Y1bsyhYVQBRIUX9PhC+5CJp3/4g3YpQlS8h/S8wu0uZuHCiNsN3994QnkF7zhl8QICx0UllA8cuvV Mh9GcujFw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1klFP9-00074O-If; Fri, 04 Dec 2020 18:02:03 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1klFP6-00073m-PR for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 18:02:01 +0000 Received: by mail-wm1-x342.google.com with SMTP id 3so7791255wmg.4 for ; Fri, 04 Dec 2020 10:01:57 -0800 (PST) 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=GunWet4p4NzVbI1r1RYLjYsxsi2RUASEtxkEDiSdayU=; b=Jfc+OXEDeUa9mmISz8ZsnfdTU5azIgUzZSQjepScJvm9Yeu8TYr4EJM80uzI2fPPUb +VHfBX79uMGHB9tHKddRRiKYoDNVPsF81RdvXjX2YfemDOeWnvFmz3ZxiR/7JPAX22f6 5tMT6fGr07JcUY7GB6TGOBnJAKFTflWYID7FgrAq2cOxXoeSVAUMIZbgYmETKwvczVHC i2uHt2MIyl9qCZGghiulFP8richVb8xc9cRAfdQic9NmrXZkgiKYKb9exgtCKAG2qi7s +K6FOWmZssDvDm3FjzNmaKJV02LM7JGkf/1TCuPcURVOz8hqELdq/Q7z3jGSEoQGCoBB FD1A== 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=GunWet4p4NzVbI1r1RYLjYsxsi2RUASEtxkEDiSdayU=; b=sSKCR44nseMzVg4hDFZIQD9YnG8okpEnUqXItekr2RzbGqEZD2uBfsrDkfZtam9BKu o4Qt7gwFRIrwp0yKusTzFRirZbvaxRgnpxRatIQDni1e/YsSVAh0UQSWUvn+mkPT+etS zXErZCPbfbZhUZ5UJeHz2B103eZ84ZlueEZGUBqAOkjYkZOz/BMznXSlDe080S1ufUDN bXCvrdb9E9C7XSdZl3vtdTh0zOjXGQDlu3uxPHBznC6avjrF7N/9onHaxNXq8IqEkFOr OJPrip5v6uBfUYm6i7iJ20vaxevzZLAGOb8XF4rqX10rb9xOFSMlo4NwozIk0d6udhG9 pyag== X-Gm-Message-State: AOAM532wGF/Cqc43cLuBkVW37hEHNGml0yucQvl7NsQRLzdCeLF4naht fjx0axwhG2vQ4DWbONuN2tQxhQ== X-Google-Smtp-Source: ABdhPJxSC8KwxX3qUAPvNVm0RO0ZB//wClhZM8fadV8xFb6AM2n7EFO2SRqrA/auNGP2dVoT3/qMcQ== X-Received: by 2002:a7b:c157:: with SMTP id z23mr5577311wmi.35.1607104916154; Fri, 04 Dec 2020 10:01:56 -0800 (PST) Received: from google.com ([2a00:79e0:d:210:f693:9fff:fef4:a7ef]) by smtp.gmail.com with ESMTPSA id u66sm4104667wmg.30.2020.12.04.10.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 10:01:55 -0800 (PST) Date: Fri, 4 Dec 2020 18:01:52 +0000 From: Quentin Perret To: Fuad Tabba Subject: Re: [RFC PATCH 16/27] KVM: arm64: Prepare Hyp memory protection Message-ID: References: <20201117181607.1761516-1-qperret@google.com> <20201117181607.1761516-17-qperret@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_130200_911498_837C3622 X-CRM114-Status: GOOD ( 13.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" , kernel-team@android.com, Frank Rowand , Suzuki K Poulose , Android KVM , Catalin Marinas , open list , Rob Herring , James Morse , "moderated list:ARM64 PORT \(AARCH64 ARCHITECTURE\)" , Marc Zyngier , Will Deacon , "open list:KERNEL VIRTUAL MACHINE FOR ARM64 \(KVM/arm64\)" , Julien Thierry 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 03 Dec 2020 at 12:57:33 (+0000), Fuad Tabba wrote: > > +int hyp_create_idmap(void); > > +int hyp_map_vectors(void); > > +int hyp_back_vmemmap(phys_addr_t phys, unsigned long size, phys_addr_t back); > > +int hyp_cpu_set_vector(enum arm64_hyp_spectre_vector slot); > > +int hyp_create_mappings(void *from, void *to, enum kvm_pgtable_prot prot); > > +int __hyp_create_mappings(unsigned long start, unsigned long size, > > + unsigned long phys, unsigned long prot); > > +unsigned long __hyp_create_private_mapping(phys_addr_t phys, size_t size, > > + unsigned long prot); > > + > > nit: I also thought that the hyp_create_mappings function names are a > bit confusing, since there's the create_hyp_mappings functions which > use the aforementioned *hyp_pgtable. Sure, happy to re-name those (and hyp_pgtable above). Any suggestions? > > +SYM_FUNC_START(__kvm_init_switch_pgd) > > + /* Turn the MMU off */ > > + pre_disable_mmu_workaround > > + mrs x2, sctlr_el2 > > + bic x3, x2, #SCTLR_ELx_M > > + msr sctlr_el2, x3 > > + isb > > + > > + tlbi alle2 > > + > > + /* Install the new pgtables */ > > + ldr x3, [x0, #NVHE_INIT_PGD_PA] > > + phys_to_ttbr x4, x3 > > +alternative_if ARM64_HAS_CNP > > + orr x4, x4, #TTBR_CNP_BIT > > +alternative_else_nop_endif > > + msr ttbr0_el2, x4 > > + > > + /* Set the new stack pointer */ > > + ldr x0, [x0, #NVHE_INIT_STACK_HYP_VA] > > + mov sp, x0 > > + > > + /* And turn the MMU back on! */ > > + dsb nsh > > + isb > > + msr sctlr_el2, x2 > > + isb > > + ret x1 > > +SYM_FUNC_END(__kvm_init_switch_pgd) > > + > > Should the instruction cache be flushed here (ic iallu), to discard > speculatively fetched instructions? Hmm, Will? Thoughts? Thanks, Quentin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel