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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 B3FBBC433F5 for ; Tue, 14 Sep 2021 07:06:59 +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 773A3610A6 for ; Tue, 14 Sep 2021 07:06:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 773A3610A6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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: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=jX+Wr1iX7vMdgFswGeEXqrY5NIjGy8IBkDpl2qzcLu0=; b=Qc86o0P79cIdSP TuXLIP0EhosloR3yK+TdWoVrEL5AvEvt3v2lUos4rzpeCmxjoB7PqD2Sj2bjl4xYkzsrdvcd6T+uN DYJ3nwAR0RC9TBHxQkBOYReF0UvoocdaFP4qPBav1OHFMeahKlqYOoZX0LwSHlU+SCGgj4bxVO45M gExQB1F5e9WGX2K/12EsLpqqQp2X47gUS/TCEHnwLBjn9A8ck5ih39KJyVhVEvr+E/AmenFdHk4YV mV02m56/onn/MPO3dtdDyonDKUz1pi07c5Zmd3y/qnPP9nTomYYOapDZ9wGwBk3wr3UDy58EcBfMN n5S/KZK3jKC36IsgqNYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ2Tv-004N40-Uv; Tue, 14 Sep 2021 07:03:52 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ2Tr-004N2g-BQ for linux-arm-kernel@lists.infradead.org; Tue, 14 Sep 2021 07:03:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631603026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DtVBH46SHKoKIwsFmytf76PwR5kg53yG9EF+y3kvUPg=; b=DthXNV5cGt95UYpThJY7moAubnRqZpF90NWZdcn7y9BGDzviRbcqg55/5O6ouLxi27zrOf q8XgmCgxICqJ5j9iFnEe8CBLnyvYqQyoW7CNlC0sRbg9OQ57nQrVbl672zZrUfFxT3rDEw VN/wN2J7oVHzPy5Vxv9hc1ofR5cXiwg= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-105-SlvNIOZXOzalpp5o7GlVBQ-1; Tue, 14 Sep 2021 03:03:44 -0400 X-MC-Unique: SlvNIOZXOzalpp5o7GlVBQ-1 Received: by mail-ed1-f72.google.com with SMTP id z6-20020a50cd06000000b003d2c2e38f1fso1417410edi.1 for ; Tue, 14 Sep 2021 00:03:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DtVBH46SHKoKIwsFmytf76PwR5kg53yG9EF+y3kvUPg=; b=qlX//9iQ6xynZI/a/XscJ2uv0hC1J0/WjZkC2kb1bAb95098fpi5uXJ+jfzXWZ679b 3wzBLpkKBugVnQLYb6kqB8wuFfJBSOBgOQvQYrsxACnam4bWfRY8f7glEuOB/ZqYyist qzzGKffKH74ALb9EKlq9kGALgc77X7sjZ0Ppoi7L1HPH1UfKgPLM3tWGjd7lKOunZbTm 37NHgKyvTpQq7uBkjozAcRZRwbtxSYnW4lj2OKnF1dTb8ZMm/cRwAN9A/56JHWu/m33c srJ6/4XafxFB+u0eWAIfSq4MQtaXMShwsFPZ0gLcGx392Pa5Vra4w1Ij1ZLHHAx7LvXn CFmQ== X-Gm-Message-State: AOAM531cIEx9YdmvRCWs+0m9N/cEQwzuIfgU91M8JnScvzYfn+huKV02 jzLNVtey4ogpuxd3Yj08cLfNwnEsF9Ocov11Pfyrbx7rXlzwDppSLXOy5g3edH04Yx4SglAhDJF fdl3GeL+OtgvAeEANKByBBQOeeeRtLJNvBYo= X-Received: by 2002:a05:6402:b51:: with SMTP id bx17mr3708307edb.193.1631603023664; Tue, 14 Sep 2021 00:03:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0u6Qmz0LoEVgIkKptzeNa1oFg+cIIJwCsprxz814Q0ubDMMz/MEr05MP7ZdWlQt3KbrYwPQ== X-Received: by 2002:a05:6402:b51:: with SMTP id bx17mr3708282edb.193.1631603023377; Tue, 14 Sep 2021 00:03:43 -0700 (PDT) Received: from gator.home (cst2-174-132.cust.vodafone.cz. [31.30.174.132]) by smtp.gmail.com with ESMTPSA id bq4sm4460079ejb.43.2021.09.14.00.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 00:03:42 -0700 (PDT) Date: Tue, 14 Sep 2021 09:03:40 +0200 From: Andrew Jones To: Raghavendra Rao Ananta Cc: Paolo Bonzini , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , Peter Shier , Ricardo Koller , Oliver Upton , Reiji Watanabe , Jing Zhang , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v6 09/14] KVM: arm64: selftests: Add guest support to get the vcpuid Message-ID: <20210914070340.u6fp5zo7pjpxdlga@gator.home> References: <20210913230955.156323-1-rananta@google.com> <20210913230955.156323-10-rananta@google.com> MIME-Version: 1.0 In-Reply-To: <20210913230955.156323-10-rananta@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=drjones@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210914_000347_567525_9C24D018 X-CRM114-Status: GOOD ( 19.20 ) 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 Mon, Sep 13, 2021 at 11:09:50PM +0000, Raghavendra Rao Ananta wrote: > At times, such as when in the interrupt handler, the guest wants > to get the vcpuid that it's running on to pull the per-cpu private > data. As a result, introduce guest_get_vcpuid() that returns the > vcpuid of the calling vcpu. The interface is architecture > independent, but defined only for arm64 as of now. > > Suggested-by: Reiji Watanabe > Signed-off-by: Raghavendra Rao Ananta > Reviewed-by: Ricardo Koller > --- > tools/testing/selftests/kvm/include/kvm_util.h | 2 ++ > tools/testing/selftests/kvm/lib/aarch64/processor.c | 6 ++++++ > 2 files changed, 8 insertions(+) > > diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h > index 010b59b13917..5770751a5735 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util.h > +++ b/tools/testing/selftests/kvm/include/kvm_util.h > @@ -400,4 +400,6 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc); > int vm_get_stats_fd(struct kvm_vm *vm); > int vcpu_get_stats_fd(struct kvm_vm *vm, uint32_t vcpuid); > > +int guest_get_vcpuid(void); > + > #endif /* SELFTEST_KVM_UTIL_H */ > diff --git a/tools/testing/selftests/kvm/lib/aarch64/processor.c b/tools/testing/selftests/kvm/lib/aarch64/processor.c > index db64ee206064..f1255f44dad0 100644 > --- a/tools/testing/selftests/kvm/lib/aarch64/processor.c > +++ b/tools/testing/selftests/kvm/lib/aarch64/processor.c > @@ -277,6 +277,7 @@ void aarch64_vcpu_setup(struct kvm_vm *vm, int vcpuid, struct kvm_vcpu_init *ini x86's vcpu_setup strangely uses 'int' for vcpuid even though everywhere else we use uint32_t. Unfortunately that strangeness got inherited by aarch64 (my fault). We should change it to uint32_t here (as a separate patch) and... > set_reg(vm, vcpuid, KVM_ARM64_SYS_REG(SYS_TCR_EL1), tcr_el1); > set_reg(vm, vcpuid, KVM_ARM64_SYS_REG(SYS_MAIR_EL1), DEFAULT_MAIR_EL1); > set_reg(vm, vcpuid, KVM_ARM64_SYS_REG(SYS_TTBR0_EL1), vm->pgd); > + set_reg(vm, vcpuid, KVM_ARM64_SYS_REG(SYS_TPIDR_EL1), vcpuid); > } > > void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent) > @@ -426,3 +427,8 @@ void vm_install_exception_handler(struct kvm_vm *vm, int vector, > assert(vector < VECTOR_NUM); > handlers->exception_handlers[vector][0] = handler; > } > + > +int guest_get_vcpuid(void) > +{ > + return read_sysreg(tpidr_el1); > +} ...return uint32_t here. Thanks, drew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel