From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 C72FD3F8233 for ; Mon, 15 Jun 2026 14:23:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781533419; cv=none; b=SE5QbF+MmAYS/tjlTdFhWk9N4t8wYJoCdsk2Zmzd7VBbk4h997cvEndmlsjnA9AER9e5nrHInbbRJMLBiynyBW5WOdwoq0CiHTADyTuFVjQVwyZl4oZ8iRjnPLwLEc99ye1rZwSvZg2D1PmFBJqldGNMlFIvmgus/gmlPe+Mx54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781533419; c=relaxed/simple; bh=SuA5k84F8CzYepc5vVcea7PB7aL1vv5XuJ+9UGt3UqY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=XIKtA4vh5qEfkyUhLbF+E1Z9MqRzlxjvuYuNY3ocd7yB4I5Yc9qADUaODcAkdqzvwzvXRBmDmETUfqCTVkg381qMYl9KzCDMaIUKJLOCU5cqhiVk2QMy68bencwqw0nweZsG5eBRvjwnbrONTkfwiYTRa7gYON6YOCNaqtJURyY= 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=jarWPLTa; arc=none smtp.client-ip=209.85.216.74 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="jarWPLTa" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-36d99181eaaso4353363a91.3 for ; Mon, 15 Jun 2026 07:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781533416; x=1782138216; 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=BHXtQahPuqoo0NJyk6bARw0tNhBOnPrj2MIbG+a6220=; b=jarWPLTaeFhjUzvFCUM/zc77KIymb7SlIXLB8dd3LSrYUEyiFVJYDTAUW9fWjCa4l5 s61TppxQNPHVjGIEzgQ/DQrxygayEBdtsCq1pJrEnzn8xwntWzZSL1JGaf+2TzWlkKU7 PHDC+lnnTYPYo1rDJ57yw8azu8AIpAGkqKKfnjjm40RH9Exvrd4ODbXBmALBNpxXfhfs VdcbUO9uvMLt7wAKlWYkf4SQpSKYQfdiizULubZxjjZ08q6UQpUU+IkE7Krf8jTnfqw0 UP570By/HE5ufVg2jDuqB+KnFhcRnbhLaX77sN/zeGfFLZWha9Nxztb65XsFGHQ0l4Zn aL3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781533416; x=1782138216; 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=BHXtQahPuqoo0NJyk6bARw0tNhBOnPrj2MIbG+a6220=; b=G95IenI4TYIT1A/+59f/qhfB4nD481DhegsIBwgZvailldK2IClE3xZKfY8ZClB6x3 oC03eQoyFPtIMcyE8g2SNSIqvUEqc6oepHOMpdLkJcAQ4kL9djhCYL+LFgOiKc6kgm9c 8/Iu2PrVc7rXQrI0Y/D4pH6QcCltAgB1BhEOvy14gstatNOu7HS4+F/8R6MfBwFh3J++ z0P3p/6IBVzKZFXyQgXx0owCSCubUBZC9KaTnFnndS8lrNxnsa2tO7UMtOw4NiVKwnAm h0yNpY6pduSvFq21h29Gz/u3N+GB0+NuQHB8OATHaQp+ggOdLyOWishVzWiKIhHr4TRp 0KNg== X-Forwarded-Encrypted: i=1; AFNElJ+hZG2X1ktxRwWUa6qkPV3nfLzeqhHsIYMFVkcezILfB1lUs1Eg0nMeVe9lO7rZFDbB8lH4lcpiyRvdjX0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2VGQvpE3Om5ICko4D6QHMHxxzK5e9939fn2sQtwIjBUfbnrNZ L9JssnM9JlzWxLlxNwsMlFa3znxuap6zPaDzZEoOhXmEYyRkVUxK322i7Qg1oenAKClMGlA09lo ERymW9g== X-Received: from pjbmj16.prod.google.com ([2002:a17:90b:3690:b0:373:40c6:a8c9]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:57ee:b0:36a:d51d:42ef with SMTP id 98e67ed59e1d1-37c2bd033b4mr11299785a91.13.1781533415878; Mon, 15 Jun 2026 07:23:35 -0700 (PDT) Date: Mon, 15 Jun 2026 07:23:35 -0700 In-Reply-To: <477ed5cf76f73379886c01bdf1a0f47c984f2de9.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260613000329.732085-1-seanjc@google.com> <20260613000329.732085-31-seanjc@google.com> <477ed5cf76f73379886c01bdf1a0f47c984f2de9.camel@intel.com> Message-ID: Subject: Re: [PATCH v4 30/30] KVM: x86: Move a pile of stuff from kvm_host.h => x86.h From: Sean Christopherson To: Kai Huang Cc: "pbonzini@redhat.com" , "vkuznets@redhat.com" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "yosry@kernel.org" Content-Type: text/plain; charset="us-ascii" On Mon, Jun 15, 2026, Kai Huang wrote: > On Fri, 2026-06-12 at 17:03 -0700, Sean Christopherson wrote: > > Move the majority of remaining KVM-internal declarations and defines in > > kvm_host.h to x86.h, so that kvm_host.h only holds structure and function > > definitions that need to be visible to arch-neutral KVM. > > > > Land the emulator interfaces in x86.h, even though kvm_emulate.h *seems* > > like a good home, as the interfaces and defines being moved are provided by > > x86.c. I.e. keep kvm_emulate.h as an interface to the emulator proper. > > > > Note, any "misses" are likely unintentional. > > > > Signed-off-by: Sean Christopherson > > [...] > > > - > > #define TSS_IOPB_BASE_OFFSET 0x66 > > #define TSS_BASE_SIZE 0x68 > > #define TSS_IOPB_SIZE (65536 / 8) > > Nit: Seems sashiko was right about TSS_IOPB_BASE and the related macros can be > moved out of asm/kvm_host.h (ditto for the enum of TASK_SWITCH_*)? Hmm, agreed. arch/x86/kvm/tss.h seems like the perfect fit. It would be easy to slot in a patch to move these ahead of the bulk move to x86.h. > https://lore.kernel.org/kvm/20260530075928.888B61F00893@smtp.kernel.org/ > > But you said "majority" in the changelog, so we can always do more cleanup > later. :-) > > [...] > > > +void __kvm_set_or_clear_apicv_inhibit(struct kvm *kvm, > > + enum kvm_apicv_inhibit reason, bool set); > > +void kvm_set_or_clear_apicv_inhibit(struct kvm *kvm, > > + enum kvm_apicv_inhibit reason, bool set); > > + > > +static inline void kvm_set_apicv_inhibit(struct kvm *kvm, > > + enum kvm_apicv_inhibit reason) > > +{ > > + kvm_set_or_clear_apicv_inhibit(kvm, reason, true); > > +} > > + > > +static inline void kvm_clear_apicv_inhibit(struct kvm *kvm, > > + enum kvm_apicv_inhibit reason) > > +{ > > + kvm_set_or_clear_apicv_inhibit(kvm, reason, false); > > +} > > + > > The definition of 'enum kvm_apicv_inhibit' remains in asm/kvm_host.h. Is it > because "trace.h" still uses APICV_INHIBIT_REASONS? No, pretty sure I just overlooked the enum. I'll do another pass of kvm_host.h to see what #defines and enums can be moved.