From nobody Sun Nov 24 21:46:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1720068154; cv=none; d=zohomail.com; s=zohoarc; b=CqSH6Qkq3qkayHKVKZT6EI16oRKRY+YdgFqwF0PtGEO3Ft/5kLsCmu+n/aY6CYypPgUurTvEA1//9qEDuYAlw/VvWEFCLCk9epIWjeRVB3R7CPx7Tc8L5clTPIP92JcLlu1KqVNoWDLIN29r+EX1P8EyGqLzklImJKLA+29TkNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720068154; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=954FZtnJ/4RzyioUlGQPdT8LzFDA4On2KO0MEDyOHSQ=; b=MspOGFnCnBka5VZGDZpiiH+//kj7WoA6aN/bd1/V7IAsmQZa1rU/QNerl+HoKuWptN/D0uKU1ZJy1QIGWKyv47e+Vtgz/exLaSr+iN8u8ER29aXuFS9XFZHFF5QZ6tLaESQuQFRo6doyIypPiNI8mD4SilK2Wvf7+Ztjo56kZkE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1720068154425605.8593910147642; Wed, 3 Jul 2024 21:42:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPEIL-0003gN-Qf; Thu, 04 Jul 2024 00:42:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPDWx-0007Be-HS for qemu-devel@nongnu.org; Wed, 03 Jul 2024 23:53:11 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPDWw-0002Jl-0Z for qemu-devel@nongnu.org; Wed, 03 Jul 2024 23:53:11 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2c8e422c40cso168355a91.2 for ; Wed, 03 Jul 2024 20:53:09 -0700 (PDT) Received: from localhost.localdomain (113-131-184-203.on-nets.com. [203.184.131.113]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c99a92c1ffsm364594a91.9.2024.07.03.20.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 20:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720065188; x=1720669988; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=954FZtnJ/4RzyioUlGQPdT8LzFDA4On2KO0MEDyOHSQ=; b=h6is+Gak77uaRvH74MzbI6m8T4T8kqa0M8U179MuKO8SgpPPlwmZGovE3FnH9im/ma ymNs2ETGouX3AlIp+9anrxqOAmHiXDSshZxLRmWyxlygI6+6LDcayUeywL18GuEQh2qS PLX4gkze5r6VHCKLnBfoaSlPFoYOpK0uv8q62hBd9TZxJtfEr9J0LODpJ/sjo+uyXf7T 9KSoxaPaqEOzkweNFYtJ2Mt5GkPIT7dSQ9lpVkl3YVGRUvECO+srr9RCzIawm3hQR1yN J13zstXpWsEkh7+OVy3bLZWkGjdDxnCXqhkKD0tOYbKh7TV116hQnf5//+ohDAfz2bP7 vGLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720065188; x=1720669988; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=954FZtnJ/4RzyioUlGQPdT8LzFDA4On2KO0MEDyOHSQ=; b=frzqaG0WXDdIRNdChk5rSiyiygl0HKguhKsf3L4BFuV4+KNiXDUuFs2Es8tcBOFeWx IT+DZd0soTwgty3aPW0M5JYjoEu125jFpGpvoAQKPp00Q9IT5z8FbBkap7wcQn/BEf6Y wiA/7gMYtNFza7NSm/GtBZAXrIzLL3at9p4/xYwKLFiSiMU3IxS35GDzhUwLaacYUj57 tEfv9ZadEtPoNx6AYTbLVyq4aVJG2WY8VL66nVo233xCuA1xeoGZfNzkCZKzlis4I8ka wD+tiuXCHYx3g7qIbDaTXaMFSAgrmkYT932+Rdcm+Lo29QzY2K8mC9PnL1WNXd6crhro 6xtw== X-Forwarded-Encrypted: i=1; AJvYcCV/389W9PD8bWlmdSrTAY5ZCAQXpWbaDRObwrWgmUxw/evkkMJ0n4f+fTUEv8viS8H9zEbs5n2A4Ej4rcX9As1CQyra89I= X-Gm-Message-State: AOJu0YxF9kSjEso5JuvIh7NZxpoMKDlOkExvl9Im911Ozqb30xVAfsl4 xt39MOBysdAPsgcmMUp/OljqBoBr0gep0jy9E8+F1LIqFC8X0wAF X-Google-Smtp-Source: AGHT+IFRMlIb1Y/nzC4AbH6bz91LMqWAoqdE4GHKAN0D40uVBdeFwbe6LoWEJMCtykolU1eTes54jQ== X-Received: by 2002:a17:90a:7406:b0:2c9:7cb6:38b0 with SMTP id 98e67ed59e1d1-2c99c694cdbmr302720a91.19.1720065187961; Wed, 03 Jul 2024 20:53:07 -0700 (PDT) From: YeeLi To: mst@redhat.com, jasowang@redhat.com Cc: pbonzini@redhat.com, richard.henderson@linaro.org, eduardo@habkost.net, qemu-devel@nongnu.org, yeeli Subject: [PATCH] intel-iommu: fix Read DMAR IQA REG DW Date: Thu, 4 Jul 2024 11:53:02 +0800 Message-Id: <20240704035302.306244-1-seven.yi.lee@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=seven.yi.lee@gmail.com; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 04 Jul 2024 00:42:05 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1720068154937100001 Content-Type: text/plain; charset="utf-8" From: yeeli When dmar_readq or devmem2 read the DW of IQA always 0UL because "& VTD_IQA_QS". So, try to fix it. case: after vtd_mem_write IQA val: 0x100206801 after vtd_mem_read IQA val: 0x100206001 Signed-off-by: yeeli --- hw/i386/intel_iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 37c21a0aec..e230a45940 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2938,7 +2938,8 @@ static uint64_t vtd_mem_read(void *opaque, hwaddr add= r, unsigned size) =20 /* Invalidation Queue Address Register, 64-bit */ case DMAR_IQA_REG: - val =3D s->iq | (vtd_get_quad(s, DMAR_IQA_REG) & VTD_IQA_QS); + val =3D s->iq | (vtd_get_quad(s, DMAR_IQA_REG) & VTD_IQA_QS + | VTD_IQA_DW_MASK); if (size =3D=3D 4) { val =3D val & ((1ULL << 32) - 1); } --=20 2.34.1