From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Suzuki K. Poulose" Subject: Re: [PATCH v2 8/8] arm64: kvm: Check support for AArch32 for 32bit guests Date: Wed, 2 Mar 2016 10:22:39 +0000 Message-ID: <56D6BEEF.3000208@arm.com> References: <1456393968-17386-1-git-send-email-suzuki.poulose@arm.com> <1456393968-17386-9-git-send-email-suzuki.poulose@arm.com> <56D6AD72.8010108@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; Format="flowed" Content-Transfer-Encoding: base64 Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 79F1341145 for ; Wed, 2 Mar 2016 05:15:36 -0500 (EST) 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 6dJn5zFUlCwN for ; Wed, 2 Mar 2016 05:15:34 -0500 (EST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3DA41410EB for ; Wed, 2 Mar 2016 05:15:33 -0500 (EST) In-Reply-To: <56D6AD72.8010108@arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: Marc Zyngier , linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, ynorov@caviumnetworks.com, kvmarm@lists.cs.columbia.edu List-Id: kvmarm@lists.cs.columbia.edu T24gMDIvMDMvMTYgMDk6MDgsIE1hcmMgWnluZ2llciB3cm90ZToKPiBPbiAyNS8wMi8xNiAwOTo1 MiwgU3V6dWtpIEsgUG91bG9zZSB3cm90ZToKCj4+IEkgcmVhbGx5IHdhbnRlZCB0byBwYXNzIGt2 bV92Y3B1IGRvd24gdG8gdGhlIGhlbHBlcnMuIEJ1dCB0aGVuLCBJIGNh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XQgdG9vayBtZSA1IG1pbnV0ZXMgc3RhcmluZyBhdCB0 aGUKPiBleHByZXNzaW9uIGFuZCByZW1lbWJlcmluZyB0aGF0IEFBcmNoMzIgRUwxIGltcGxpZXMg QUFyY2gzMiBFTDAgdG8gZ2V0IGl0KS4KPgo+IE5vdywgd2UgYWxyZWFkeSBoYXZlIGt2bV9yZXNl dF92Y3B1KCkgdGhhdCB2YWxpZGF0ZXMgQUFyY2gzMiBzdXBwb3J0LiBJdAo+IHdvdWxkIHByb2Jh Ymx5IGJlIGJldHRlciB0byBtb3ZlIHRoaW5ncyB0aGVyZS4gVGhvdWdodHM/CgpEZWZpbml0ZWx5 LiBJIG92ZXJsb29rZWQgdGhlIGZ1bmN0aW9uIG5hbWUgdG8gZG8gc29tZXRoaW5nCnNwZWNpZmlj IHRvIHJlc2V0dGluZyB0aGUgQ1BVIHRoYW4gZG9pbmcgc29tZSBjaGVja3MgOiguCkkgd2lsbCBy ZXNwaW4gaXQuCgpDaGVlcnMKU3V6dWtpCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fCmt2bWFybSBtYWlsaW5nIGxpc3QKa3ZtYXJtQGxpc3RzLmNzLmNvbHVt YmlhLmVkdQpodHRwczovL2xpc3RzLmNzLmNvbHVtYmlhLmVkdS9tYWlsbWFuL2xpc3RpbmZvL2t2 bWFybQo= From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suzuki.Poulose@arm.com (Suzuki K. Poulose) Date: Wed, 2 Mar 2016 10:22:39 +0000 Subject: [PATCH v2 8/8] arm64: kvm: Check support for AArch32 for 32bit guests In-Reply-To: <56D6AD72.8010108@arm.com> References: <1456393968-17386-1-git-send-email-suzuki.poulose@arm.com> <1456393968-17386-9-git-send-email-suzuki.poulose@arm.com> <56D6AD72.8010108@arm.com> Message-ID: <56D6BEEF.3000208@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 02/03/16 09:08, Marc Zyngier wrote: > On 25/02/16 09:52, Suzuki K Poulose wrote: >> I really wanted to pass kvm_vcpu down to the helpers. But then, I can't >> define the arch specific helper in asm/kvm_host.h due to lack of kvm_vcpu's >> definition yet: >> >> In file included from include/linux/kvm_host.h:35:0, >> from arch/arm64/kernel/asm-offsets.c:24: >> ./arch/arm64/include/asm/kvm_host.h: In function ?kvm_arch_vcpu_validate_features?: >> ./arch/arm64/include/asm/kvm_host.h:344:48: error: dereferencing pointer to incomplete type >> return !test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features) || > > Why don't you just have the prototype in kvm_host.h, and move the actual > implementation to something like guest.c? But I think there is a better > approach, see below. I thought it would better be a static inline. But, the GCC can do that, silly me :) > > This is really convoluted (it took me 5 minutes staring at the > expression and remembering that AArch32 EL1 implies AArch32 EL0 to get it). > > Now, we already have kvm_reset_vcpu() that validates AArch32 support. It > would probably be better to move things there. Thoughts? Definitely. I overlooked the function name to do something specific to resetting the CPU than doing some checks :(. I will respin it. Cheers Suzuki From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754218AbcCBKWp (ORCPT ); Wed, 2 Mar 2016 05:22:45 -0500 Received: from foss.arm.com ([217.140.101.70]:57616 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753838AbcCBKWn (ORCPT ); Wed, 2 Mar 2016 05:22:43 -0500 Subject: Re: [PATCH v2 8/8] arm64: kvm: Check support for AArch32 for 32bit guests To: Marc Zyngier , linux-arm-kernel@lists.infradead.org References: <1456393968-17386-1-git-send-email-suzuki.poulose@arm.com> <1456393968-17386-9-git-send-email-suzuki.poulose@arm.com> <56D6AD72.8010108@arm.com> Cc: christoffer.dall@linaro.org, will.deacon@arm.com, ynorov@caviumnetworks.com, catalin.marinas@arm.com, mark.rutland@arm.com, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu From: "Suzuki K. Poulose" Message-ID: <56D6BEEF.3000208@arm.com> Date: Wed, 2 Mar 2016 10:22:39 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <56D6AD72.8010108@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/16 09:08, Marc Zyngier wrote: > On 25/02/16 09:52, Suzuki K Poulose wrote: >> I really wanted to pass kvm_vcpu down to the helpers. But then, I can't >> define the arch specific helper in asm/kvm_host.h due to lack of kvm_vcpu's >> definition yet: >> >> In file included from include/linux/kvm_host.h:35:0, >> from arch/arm64/kernel/asm-offsets.c:24: >> ./arch/arm64/include/asm/kvm_host.h: In function ‘kvm_arch_vcpu_validate_features’: >> ./arch/arm64/include/asm/kvm_host.h:344:48: error: dereferencing pointer to incomplete type >> return !test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features) || > > Why don't you just have the prototype in kvm_host.h, and move the actual > implementation to something like guest.c? But I think there is a better > approach, see below. I thought it would better be a static inline. But, the GCC can do that, silly me :) > > This is really convoluted (it took me 5 minutes staring at the > expression and remembering that AArch32 EL1 implies AArch32 EL0 to get it). > > Now, we already have kvm_reset_vcpu() that validates AArch32 support. It > would probably be better to move things there. Thoughts? Definitely. I overlooked the function name to do something specific to resetting the CPU than doing some checks :(. I will respin it. Cheers Suzuki