From: Michael Ellerman Date: Thu, 11 Jul 2019 12:57:31 +0000 Subject: Re: [PATCH v4 6/8] KVM: PPC: Ultravisor: Restrict LDBAR access Message-Id: <87h87sg24k.fsf@concordia.ellerman.id.au> List-Id: References: <20190628200825.31049-1-cclaudio@linux.ibm.com> <20190628200825.31049-7-cclaudio@linux.ibm.com> In-Reply-To: <20190628200825.31049-7-cclaudio@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Claudio Carvalho , linuxppc-dev@ozlabs.org Cc: Madhavan Srinivasan , Michael Anderson , Ram Pai , Claudio Carvalho , kvm-ppc@vger.kernel.org, Bharata B Rao , Ryan Grimm , Sukadev Bhattiprolu , Thiago Bauermann , Anshuman Khandual Claudio Carvalho writes: > When the ultravisor firmware is available, it takes control over the > LDBAR register. In this case, thread-imc updates and save/restore > operations on the LDBAR register are handled by ultravisor. Please roll up the replies to Alexey's question about LDBAR into the change log. > diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S > index f9b2620fbecd..cffb365d9d02 100644 > --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S > +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S > @@ -375,8 +375,10 @@ BEGIN_FTR_SECTION > mtspr SPRN_RPR, r0 > ld r0, KVM_SPLIT_PMMAR(r6) > mtspr SPRN_PMMAR, r0 > +BEGIN_FW_FTR_SECTION_NESTED(70) > ld r0, KVM_SPLIT_LDBAR(r6) > mtspr SPRN_LDBAR, r0 > +END_FW_FTR_SECTION_NESTED(FW_FEATURE_ULTRAVISOR, 0, 70) That's in Power8 code isn't it? Which will never have an ultravisor. > diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c > index 1b6932890a73..5fe2d4526cbc 100644 > --- a/arch/powerpc/platforms/powernv/opal-imc.c > +++ b/arch/powerpc/platforms/powernv/opal-imc.c > @@ -254,6 +254,10 @@ static int opal_imc_counters_probe(struct platform_device *pdev) > bool core_imc_reg = false, thread_imc_reg = false; > u32 type; > > + /* Disable IMC devices, when Ultravisor is enabled. */ > + if (firmware_has_feature(FW_FEATURE_ULTRAVISOR)) > + return -EACCES; I don't mind taking this change. But at the same time should the IMC stuff just be omitted from the device tree when we're in ultravisor mode? cheers