Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1058823pxb; Wed, 6 Apr 2022 07:46:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvzh+DTpEXaPG92RVqfU3K7ggBJOtiFoNqR1/tZRJZIy3Dre3rOG/LFHe75qc9EfT/TdAV X-Received: by 2002:a17:90b:384b:b0:1c7:41fd:9991 with SMTP id nl11-20020a17090b384b00b001c741fd9991mr10474168pjb.199.1649256416211; Wed, 06 Apr 2022 07:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649256416; cv=none; d=google.com; s=arc-20160816; b=BUnD+9yu0m/7v8sLmgqvhOo9o+rS1zzQKdo+6rB25aIWJdK9NYhlRO5CXEUzWPkug+ xf8EsYR7phWSlfgchO7d3LpUO6n7ZkP4c8ZAxabYLRuPfK/NN1nO/P4KHAIZIaJokWwg 4VhDgh4g0DooThVnlftwCcIKLaX4YUWohfKwog3HzlIT/CKA4Exx8eEAW7bOKaTuvFHV v4aT6aH3v+ZNo0JZ2/m42eM/9kLtmPhiazXKIFTPBEIPzQd6qHV2PpA36cYG5pQ7xiUf yDeRlNop+fi/+kcssFhXB+E4rc+qT1Y3Q83qNJ0vkWpdG0aN27d24kAbpAcLTl4RQd8Y 5fEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:git:git:git:git :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=c0oPDeGfwoeq7PskOiqL9sZerZxGJMeZ2fI2Uickm/A=; b=Z05O5d6lh2eNULXPEvJBitH6D9iMr1A3gc05yUSmLLwUtOT3ug+djqKfw5mOcW6UBa 4j5KtGBENGCJEZjaX6H/NOIQ5OgRCCDAMQkcaTM4P0AMAeaZrvU4o3GIuhWZL/W4A0dk Xmn1PFLSxDTpqeucnLL6cWoq3wJMGdVSK6lyyI1UM34bh+YWT9P3d5Ardh8NPUBugxZq os+K5AsnKRTU2qly0ekB/dk5rEmHV2aOEygjwUWwNuaF0+a3g/i34P46PxKmkOjcfi2N A/EuH/ocI35py/cfLO7rXcoMfWfXh1KICkqSs43vMsO6dW82KTxOswR/gVrvzOTvpjaC Agxg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o12-20020a63fb0c000000b003864801cb6asi16102747pgh.202.2022.04.06.07.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 07:46:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C009F6CCD20; Wed, 6 Apr 2022 05:49:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230341AbiDFMu7 (ORCPT + 99 others); Wed, 6 Apr 2022 08:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbiDFMuL (ORCPT ); Wed, 6 Apr 2022 08:50:11 -0400 Received: from mail.codelabs.ch (mail.codelabs.ch [IPv6:2a02:168:860f:1::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEAA0206EDC; Wed, 6 Apr 2022 01:53:52 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.codelabs.ch (Postfix) with ESMTP id E096F220002; Wed, 6 Apr 2022 10:37:03 +0200 (CEST) Received: from mail.codelabs.ch ([127.0.0.1]) by localhost (fenrir.codelabs.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wm3KiR0YfLUt; Wed, 6 Apr 2022 10:37:02 +0200 (CEST) Received: from skyhawk.codelabs.local (unknown [IPv6:2a02:169:803:0:f7fb:8040:b3e4:bffe]) by mail.codelabs.ch (Postfix) with ESMTPSA id A7A93220001; Wed, 6 Apr 2022 10:37:02 +0200 (CEST) From: Reto Buerki To: dwmw2@infradead.org Cc: x86@kernel.org, kvm@vger.kernel.org, iommu@lists.linux-foundation.org, joro@8bytes.org, tglx@linutronix.de, pbonzini@redhat.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, maz@misterjones.org, decui@microsoft.com Subject: Re: [PATCH v3 12/35] x86/msi: Provide msi message shadow structs Date: Wed, 6 Apr 2022 10:36:23 +0200 Message-Id: <20220406083624.38739-1-reet@codelabs.ch> In-Reply-To: 20201024213535.443185-13-dwmw2@infradead.org References: <20201024213535.443185-13-dwmw2@infradead.org> MIME-Version: 1.0 GIT: Lines beginning in "GIT:" will be removed. GIT: Consider including an overall diffstat or table of contents GIT: for the patch you are writing. GIT: Clear the body content if you don't wish to send a summary. Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While working on some out-of-tree patches, we noticed that assignment to dmar_subhandle of struct x86_msi_data lead to a QEMU warning about reserved bits in MSI data being set: qemu-system-x86_64: vtd_interrupt_remap_msi: invalid IR MSI (sid=256, address=0xfee003d8, data=0x10000) This message originates from hw/i386/intel_iommu.c in QEMU: #define VTD_IR_MSI_DATA_RESERVED (0xffff0000) if (origin->data & VTD_IR_MSI_DATA_RESERVED) { ... } Looking at struct x86_msi_data, it appears that it is actually 48-bits in size since the bitfield containing the vector, delivery_mode etc is 2 bytes wide followed by dmar_subhandle which is 32 bits. Thus assignment to dmar_subhandle leads to bits > 16 being set. If I am not mistaken, the MSI data field should be 32-bits wide for all platforms (struct msi_msg, include/linux/msi.h). Is this analysis correct or did I miss something wrt. handling of dmar_subhandle? The attached patch fixes the issue for us. Regards, - reto