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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E23DC10F05 for ; Wed, 6 Dec 2023 16:33:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378551AbjLFQd1 (ORCPT ); Wed, 6 Dec 2023 11:33:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378338AbjLFQdZ (ORCPT ); Wed, 6 Dec 2023 11:33:25 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC1C0D3; Wed, 6 Dec 2023 08:33:30 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701880409; 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=mEaYjes49h5l2UrFqiq7e/jCeK/naAAzBiirxhQzhc8=; b=aAvqveN+yO3hoMfIlimEtuaxwhgvna0Ou/j29UGyQS7lm54ba0nXr0Tt1as+OBFPtwVpdK j49aitst25afRLI6yPRRZMOknvg8XN/djd9ir7We/GY7KWj3e6EvV3rujrCITZzozzJfzi NxAaygeYrNqoUGv0/h9XCNOPg2BrJ6ihwanGEV14zbyAxuJwM63Mni9IdC7E/CSFfZxLC4 15tx/FMXHlfMwlmtkVdKKvWoaTLTFxAOn55L9lE+GwTpZsUcMeqTLwpWjWclL1ArJiz9kr 2XuzMbwKjzLL5XGrNNo+arQ+Nt9PDsGcEQa4IRXZpyOk/nZgFwlE8O07w7U3fg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701880409; 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=mEaYjes49h5l2UrFqiq7e/jCeK/naAAzBiirxhQzhc8=; b=Krj3CK7I8oY4UPJ8ojb0Z+E5QF/2QTLdhVsRXSSUnhW6eWEJfzPDr+g8EsQhCtDQFN8q1y CZdmFnO8KDP6huCQ== To: Jacob Pan , LKML , X86 Kernel , iommu@lists.linux.dev, Lu Baolu , kvm@vger.kernel.org, Dave Hansen , Joerg Roedel , "H. Peter Anvin" , Borislav Petkov , Ingo Molnar Cc: Raj Ashok , "Tian, Kevin" , maz@kernel.org, peterz@infradead.org, seanjc@google.com, Robin Murphy , Jacob Pan Subject: Re: [PATCH RFC 01/13] x86: Move posted interrupt descriptor out of vmx code In-Reply-To: <20231112041643.2868316-2-jacob.jun.pan@linux.intel.com> References: <20231112041643.2868316-1-jacob.jun.pan@linux.intel.com> <20231112041643.2868316-2-jacob.jun.pan@linux.intel.com> Date: Wed, 06 Dec 2023 17:33:28 +0100 Message-ID: <87wmtruw87.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 11 2023 at 20:16, Jacob Pan wrote: > +/* Posted-Interrupt Descriptor */ > +struct pi_desc { > + u32 pir[8]; /* Posted interrupt requested */ > + union { > + struct { > + /* bit 256 - Outstanding Notification */ > + u16 on : 1, > + /* bit 257 - Suppress Notification */ > + sn : 1, > + /* bit 271:258 - Reserved */ > + rsvd_1 : 14; > + /* bit 279:272 - Notification Vector */ > + u8 nv; > + /* bit 287:280 - Reserved */ > + u8 rsvd_2; > + /* bit 319:288 - Notification Destination */ > + u32 ndst; This mixture of bitfields and types is weird and really not intuitive: /* Posted-Interrupt Descriptor */ struct pi_desc { /* Posted interrupt requested */ u32 pir[8]; union { struct { /* bit 256 - Outstanding Notification */ u64 on : 1, /* bit 257 - Suppress Notification */ sn : 1, /* bit 271:258 - Reserved */ : 14, /* bit 279:272 - Notification Vector */ nv : 8, /* bit 287:280 - Reserved */ : 8, /* bit 319:288 - Notification Destination */ ndst : 32; }; u64 control; }; u32 rsvd[6]; } __aligned(64); Hmm? > +static inline bool pi_test_and_set_on(struct pi_desc *pi_desc) > +{ > + return test_and_set_bit(POSTED_INTR_ON, > + (unsigned long *)&pi_desc->control); Please get rid of those line breaks. Thanks, tglx