Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1218420rdg; Fri, 13 Oct 2023 14:06:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZAPd+xMuO7MPeQdeF+a0a5L9PW04PYQJQkLy/C5ZUie/82M5c4nXXwASl2U4+pJqjxyi/ X-Received: by 2002:a05:6a20:96c1:b0:160:6577:c527 with SMTP id hq1-20020a056a2096c100b001606577c527mr25141902pzc.52.1697231164842; Fri, 13 Oct 2023 14:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697231164; cv=none; d=google.com; s=arc-20160816; b=pSCy7Vm+nU4vOUFN13zYdUQkRFXiF9fW2mdbMUdv22/wfqe3egg8SKPQj28AbLzXPG xrss0xqDWlr96iI4b7Bx7vSQ/4kQvWskI8AwrvFiovRWRS5E1koYIHXkcVTCUWaachrb vnhA2Bu9kUYM7UhG3BcCIBFurJLHSafIX57KbDunNSi3Z1TmR87V+LXSClnAunI5c6fF q9Msy9pPMMmR7g6osvl0zZ2L3e5vhclIy2fBkDflW8F9UJq2HpKpx+5fezh4pbn16fBC SzcF8PdrO4pnDANJqZfLYSdr8vsf9vJhn3VlaO/Eq9dqLscZB+g5b5fCFbJXtQ19LkHz cAnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9loeVc7ZCpz1U3HtoGFGkfvxqtu4wzzEKlz442ZZopc=; fh=5jMhytPRq58LIUQuhxI7nySInEdtCgF6FGEJqikC6n4=; b=k1lbDIWd94mbCiSh2iCtkFTA5H3uDjtNvB+Lx4OU1+Onxra2cfZCy/3MMyVWHEJtWx Nw1pNDCSaQAfUIIkxESX3aTCj9VHp3Lg9xSBbO5ult6npMM7cvQsTpCCTmctHpQSIb0/ f6Yg4b6rUdz9cynGAmbgpDdwl6aRRJyvpCJ30NBNiVu2Uue0jnfT0e98Uv+ydc2BFFZh N/fSb39kwgdV88eQxOesEn7m8fy/seiJCtOpkiU/wElk3vVBgh/a5LN8jeHWCMATShSy JBFGyQF+D+WhyGa+aEaFfA7avk0+SCbnvloDQeoFwEtZt6uiUTpX/yAK2zWrNIJD09JA /Hxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2LwReX0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t34-20020a632262000000b00573fa4cfe49si5371712pgm.166.2023.10.13.14.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 14:06:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2LwReX0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3FDFA82EA143; Fri, 13 Oct 2023 14:06:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232017AbjJMVFp (ORCPT + 99 others); Fri, 13 Oct 2023 17:05:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231814AbjJMVFo (ORCPT ); Fri, 13 Oct 2023 17:05:44 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A862D7 for ; Fri, 13 Oct 2023 14:05:43 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c9c496c114so19605ad.0 for ; Fri, 13 Oct 2023 14:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697231142; x=1697835942; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9loeVc7ZCpz1U3HtoGFGkfvxqtu4wzzEKlz442ZZopc=; b=2LwReX0F3nCKV99+jdz0k4S0dJbvw+0Mk4xfx/FwvOFNcaZqXGP1XAwOc8hZw8ORhn 1KbW6N0KKxoYGZYVmstxeMe1pPBA4LpZexkvJtP2rWIAuabqu8Br8gmyqM6x3ad+3fcE kgnFpxOSCFs6uw3iPCbDnPSiB2reoYnuUd86Jaaoe/VZB7z3WKfEyGrCKZkMQ3hhv/a/ YynDLOY++f5gyTKJj22bfjVMbyfhWqoLNQjil9IsqxRAzPBrORlxLbtVHxUpuCx8MTaY hHbVg4r79cC+bm7Ij0+24+x5+e4eI34OsF5iLwpGWlPeruzHP4L5TccoYbCK94rF4FV7 VSMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697231142; x=1697835942; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9loeVc7ZCpz1U3HtoGFGkfvxqtu4wzzEKlz442ZZopc=; b=XPWC9FY1OzUuE/RG9uRSzeW4ZIs0GLezQyS7vOMCyPELtoKFxvUJiQkUDGJkInmapA +DUz1H6NhuRLEW0wBOPNBLQPRJpVAR53YCWRZY19k68CSIh36+PUCRG1W4E3juIMYWZU f1gzYmyBl6uYL5d7B3Jx14YQ4v0rzlSTNVsb3wzS19Lt0y8RAw+aVVaIB7Fr8kuNM5Yl Qul9oRbLlu2r45Xc8GdiC8hXArOQWIFiWySsN7CfUTkNzHrJcjgqq4Yj3qYKFZG5xzr3 fBajnpvciuky3dA7WYNOrR/Zh0K8pvc0yG7Cj//vCr9OQHR6oOCaHbT/qGS/muVRqN+a wxgg== X-Gm-Message-State: AOJu0YwxMjOL62aNrwGJT9L8weM4MKqWyCZ6EeNkd/kAP7aMbWB1wVzA RnRAtUlNmK+Btqim7Nl2iKL1jAsJWJH2sRpMzbIhuQ== X-Received: by 2002:a17:902:f788:b0:1c5:6691:4931 with SMTP id q8-20020a170902f78800b001c566914931mr42007pln.12.1697231142284; Fri, 13 Oct 2023 14:05:42 -0700 (PDT) MIME-Version: 1.0 References: <20231009230858.3444834-1-rananta@google.com> <20231009230858.3444834-11-rananta@google.com> <44608d30-c97a-c725-e8b2-0c5a81440869@redhat.com> <65b8bbdb-2187-3c85-0e5d-24befcf01333@redhat.com> In-Reply-To: <65b8bbdb-2187-3c85-0e5d-24befcf01333@redhat.com> From: Raghavendra Rao Ananta Date: Fri, 13 Oct 2023 14:05:29 -0700 Message-ID: Subject: Re: [PATCH v7 10/12] KVM: selftests: aarch64: Introduce vpmu_counter_access test To: Sebastian Ott , Oliver Upton Cc: Marc Zyngier , Alexandru Elisei , James Morse , Suzuki K Poulose , Paolo Bonzini , Zenghui Yu , Shaoqin Huang , Jing Zhang , Reiji Watanabe , Colton Lewis , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 14:06:02 -0700 (PDT) On Thu, Oct 12, 2023 at 8:02=E2=80=AFAM Sebastian Ott w= rote: > > On Thu, 12 Oct 2023, Sebastian Ott wrote: > > On Mon, 9 Oct 2023, Raghavendra Rao Ananta wrote: > >> +/* Create a VM that has one vCPU with PMUv3 configured. */ > >> +static void create_vpmu_vm(void *guest_code) > >> +{ > >> + struct kvm_vcpu_init init; > >> + uint8_t pmuver, ec; > >> + uint64_t dfr0, irq =3D 23; > >> + struct kvm_device_attr irq_attr =3D { > >> + .group =3D KVM_ARM_VCPU_PMU_V3_CTRL, > >> + .attr =3D KVM_ARM_VCPU_PMU_V3_IRQ, > >> + .addr =3D (uint64_t)&irq, > >> + }; > >> + struct kvm_device_attr init_attr =3D { > >> + .group =3D KVM_ARM_VCPU_PMU_V3_CTRL, > >> + .attr =3D KVM_ARM_VCPU_PMU_V3_INIT, > >> + }; > >> + > >> + /* The test creates the vpmu_vm multiple times. Ensure a clean st= ate > >> */ > >> + memset(&vpmu_vm, 0, sizeof(vpmu_vm)); > >> + > >> + vpmu_vm.vm =3D vm_create(1); > >> + vm_init_descriptor_tables(vpmu_vm.vm); > >> + for (ec =3D 0; ec < ESR_EC_NUM; ec++) { > >> + vm_install_sync_handler(vpmu_vm.vm, VECTOR_SYNC_CURRENT, = ec, > >> + guest_sync_handler); > >> + } > >> + > >> + /* Create vCPU with PMUv3 */ > >> + vm_ioctl(vpmu_vm.vm, KVM_ARM_PREFERRED_TARGET, &init); > >> + init.features[0] |=3D (1 << KVM_ARM_VCPU_PMU_V3); > >> + vpmu_vm.vcpu =3D aarch64_vcpu_add(vpmu_vm.vm, 0, &init, guest_cod= e); > >> + vcpu_init_descriptor_tables(vpmu_vm.vcpu); > >> + vpmu_vm.gic_fd =3D vgic_v3_setup(vpmu_vm.vm, 1, 64, > >> + GICD_BASE_GPA, GICR_BASE_GPA); > >> + > >> + /* Make sure that PMUv3 support is indicated in the ID register *= / > >> + vcpu_get_reg(vpmu_vm.vcpu, > >> + KVM_ARM64_SYS_REG(SYS_ID_AA64DFR0_EL1), &dfr0); > >> + pmuver =3D FIELD_GET(ARM64_FEATURE_MASK(ID_AA64DFR0_PMUVER), dfr0= ); > >> + TEST_ASSERT(pmuver !=3D ID_AA64DFR0_PMUVER_IMP_DEF && > >> + pmuver >=3D ID_AA64DFR0_PMUVER_8_0, > >> + "Unexpected PMUVER (0x%x) on the vCPU with PMUv3", > >> pmuver); > >> + > >> + /* Initialize vPMU */ > >> + vcpu_ioctl(vpmu_vm.vcpu, KVM_SET_DEVICE_ATTR, &irq_attr); > >> + vcpu_ioctl(vpmu_vm.vcpu, KVM_SET_DEVICE_ATTR, &init_attr); > >> +} > > > > This one fails to build for me: > > aarch64/vpmu_counter_access.c: In function =E2=80=98create_vpmu_vm=E2= =80=99: > > aarch64/vpmu_counter_access.c:456:47: error: =E2=80=98ID_AA64DFR0_PMUVE= R_MASK=E2=80=99 > > undeclared (first use in this function); did you mean > > =E2=80=98ID_AA64DFR0_EL1_PMUVer_MASK=E2=80=99? > > 456 | pmuver =3D FIELD_GET(ARM64_FEATURE_MASK(ID_AA64DFR0_PMU= VER), > > dfr0); > > Looks like there's a clash with > "KVM: arm64: selftests: Import automatic generation of sysreg defs" > from: > https://lore.kernel.org/r/20231003230408.3405722-12-oliver.upton@= linux.dev Thanks for the pointer, Sebastian! Surprisingly, I don't see the patch when I sync to kvmarm/next. Oliver, Aren't the selftest patches from the 'Enable writable ID regs' series [1] merged into kvmarm/next? Looking at the log, I couldn't find them and the last patch that went from the series was [2]. Am I missing something? Thank you. Raghavendra [1]: https://lore.kernel.org/all/169644154288.3677537.15121340860793882283.= b4-ty@linux.dev/ [2]: https://lore.kernel.org/all/20231003230408.3405722-11-oliver.upton@lin= ux.dev/