From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6230367F50 for ; Thu, 22 Jan 2026 16:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769097858; cv=none; b=N+kIyXlf+WVA7yd3Uk5uluZFVXppK/d1nictgPFQFynR9vqTtFJCQHm77ORkBOZX9wXZdzGdu2WPXc5YInjS0w6EKCySCW1T32zkpc27rtEKawBweXrXx4Aw0c5tUVeSIl+uhvZ3OpmM6+OHBffGdxagxn/gBUnTU1pxyr4/mUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769097858; c=relaxed/simple; bh=viNnaReSsAyqS/zLOY2ifZng9HyswNpsZThiO/XVk1s=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=VxbFwaITfyo0iHRaVjaMEcxJLrrM+DPx5fzYBooFZkKd5vSiwf6t+9CwdfYoo7Xacrz720NhV4elF1GHmM1dO/h06X2tA7YFqb5EcnQL2C4FX8+9525WK3ftvbBN3HKMeIhGX1f4Spa4XeXDCsr/mFgonjjX0pg+tm8OoXk/xas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Y4v2IVtM; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Y4v2IVtM" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2a77040ede0so11005675ad.2 for ; Thu, 22 Jan 2026 08:04:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769097848; x=1769702648; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=LD2LZ6P6QaQ5VD5Wh4MR8dbmyUc9EnoiEwigMQRIrTc=; b=Y4v2IVtM0BkDOyuRdJqbjoJxqyfmoGS39JUV2Bo/sM19bW5u6wojwwa35/8lFRDzA1 quVRKzDNcgwIl5CtdbyNKtsAJmJB9tm6PZDKXDP8neXc9BZX1p9roP7ve17ug39vutro urTIOulDUu0OA381er/9Kz+YhvEPbORgueJ67uVT8jLh8qqAjdFFUNvElpf+gMCtNKuz dKeSHHy9lsgGHVTCbAXg/GRnJJTzgwYepOYzMNywryy9ccXy2nUgTf32VR7JZr+4MSDO NvBuVi+BGLBPoEOpBGKcv8FLgL4FSMrjNjTT9z5EsnAHqHxTOXtf/6PUTFsgDH6zFie+ bwrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769097848; x=1769702648; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LD2LZ6P6QaQ5VD5Wh4MR8dbmyUc9EnoiEwigMQRIrTc=; b=wCYp2lwBZJX/ksX5e9frUTKgfMmLa3XDGOXrbi7V+vulsYTw20RlC17gHRDUrjKl9H sCr05HEXAN8FxpGeIjvfGcxfo1tEa3uN/bN0oBPueYqhMltDovwaMtvAqyioNmMYkVTj kG6Llx0R+X7qlsnqTY/baIk6SaKmUHHgFfU85mx3D3B042o8CpOlhosMNTyXa41lGGjn 52ncQgV6bsLDk7i2ipqjm6WK1RnJa8MomoBK0mBvfFKqR/pfnt0SdjsiVJ66xYUChzfM 1ZdwVmDQgxGg+ZKPk74+xQ6dxtAR304kQBSbBGMjRg5UUIztHtFliSpb4gVWX5Wy2BlO 2COQ== X-Forwarded-Encrypted: i=1; AJvYcCUIBzls/ZbEObPB+VupKN1rPRJdaTXBPzQjnbNGCWSQv7jT6cy/UtnEjN8aeXSucccAnTSaA6a/uULEYGo=@vger.kernel.org X-Gm-Message-State: AOJu0YzgOxKLBk+cZiaob8dY8imixdYgqpq0tbn1ZrjgpgepFO+H1fbH XV2mUF3p+6INB3GqjnAdhM0zQL0cO14r3kw8rYScUJl117FVrsIC3q/roDupJvhJZpYGEks5Naq ylVnGXQ== X-Received: from plbmi13.prod.google.com ([2002:a17:902:fccd:b0:29f:cd:e7da]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ec90:b0:2a2:d2e8:9f25 with SMTP id d9443c01a7336-2a76ad742e9mr77688705ad.33.1769097848122; Thu, 22 Jan 2026 08:04:08 -0800 (PST) Date: Thu, 22 Jan 2026 08:04:06 -0800 In-Reply-To: <20260121225438.3908422-2-jmattson@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260121225438.3908422-1-jmattson@google.com> <20260121225438.3908422-2-jmattson@google.com> Message-ID: Subject: Re: [PATCH 1/6] KVM: x86/pmu: Introduce amd_pmu_set_eventsel_hw() From: Sean Christopherson To: Jim Mattson Cc: Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Shuah Khan , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Wed, Jan 21, 2026, Jim Mattson wrote: > Extract the computation of eventsel_hw from amd_pmu_set_msr() into a > separate helper function, amd_pmu_set_eventsel_hw(). > > No functional change intended. > > Signed-off-by: Jim Mattson > --- > arch/x86/kvm/svm/pmu.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/svm/pmu.c b/arch/x86/kvm/svm/pmu.c > index 7aa298eeb072..33c139b23a9e 100644 > --- a/arch/x86/kvm/svm/pmu.c > +++ b/arch/x86/kvm/svm/pmu.c > @@ -147,6 +147,12 @@ static int amd_pmu_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > return 1; > } > > +static void amd_pmu_set_eventsel_hw(struct kvm_pmc *pmc) > +{ > + pmc->eventsel_hw = (pmc->eventsel & ~AMD64_EVENTSEL_HOSTONLY) | > + AMD64_EVENTSEL_GUESTONLY; Align indentation. pmc->eventsel_hw = (pmc->eventsel & ~AMD64_EVENTSEL_HOSTONLY) | AMD64_EVENTSEL_GUESTONLY; > +} > + > static int amd_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > { > struct kvm_pmu *pmu = vcpu_to_pmu(vcpu); > @@ -166,8 +172,7 @@ static int amd_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > data &= ~pmu->reserved_bits; > if (data != pmc->eventsel) { > pmc->eventsel = data; > - pmc->eventsel_hw = (data & ~AMD64_EVENTSEL_HOSTONLY) | > - AMD64_EVENTSEL_GUESTONLY; > + amd_pmu_set_eventsel_hw(pmc); > kvm_pmu_request_counter_reprogram(pmc); > } > return 0; > -- > 2.52.0.457.g6b5491de43-goog >