From nobody Sat Nov 15 14:11:19 2025 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1750175066; cv=none; d=zohomail.com; s=zohoarc; b=a03LyudjMkK3YMt8qXa8mwkyGCCoq30YwytfvU3H4u/WoqtEknFy0/HmwmuE9gsxlRxZFWAT7Sq5MW8P356LZAfataBF2fifdmDyqFBlShXJ93BJX1FVriGrfPCSd/iUi9QI7ziNOLBKUxoJDXPauuGrxBptootI54MZfwXXo4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750175066; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VaMXUiOKm3NgnC47V/YBeh8gXdNxCaiFo4kpyggwQGI=; b=MqzYEedALVncc78F8O4AWsVufSZeXy4FdtS/vNfl9lXQjzziDnez96Pq52WZloOl2jiL8HBlscVWh9QdVPugWxVbtCllM8ytFXnAqqBHTtFTAlIGrhSpWKWF0Rmw0o7/N9MjjOJ0HgQYCmnnz9F9HXDjkkotPf7VlkWodg6KnNY= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750175066188857.9941610347804; Tue, 17 Jun 2025 08:44:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uRYJ7-0002gV-0i; Tue, 17 Jun 2025 11:33:05 -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 1uRYI8-0001Fx-Rv for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:32:05 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uRXra-0006sQ-Bk for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:04:39 -0400 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEX1rs010319; Tue, 17 Jun 2025 15:04:30 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 47914enfq9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:30 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEdFdO001536; Tue, 17 Jun 2025 15:04:29 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 478yh9bxqt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:29 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 55HF4SvZ014869; Tue, 17 Jun 2025 15:04:28 GMT Received: from alaljimee5bm-ol9-20250405.osdevelopmeniad.oraclevcn.com (alaljimee5bm-ol9-20250405.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.254.235]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 478yh9bxny-2; Tue, 17 Jun 2025 15:04:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=VaMXU iOKm3NgnC47V/YBeh8gXdNxCaiFo4kpyggwQGI=; b=RMOfi5HHCTn+GRyz9m9mi E2zmZELDzQOYw4Ox9ZCVCnnJQ1EXyZdW6rcyXX5VA46YHfo6f+vbUH1n3fLVpZas /9KhyHo1o20yuBYWiiCKwlAuEMkmCb2H+1Hf4/E4ExVobjSZPBpVVx80Qzc1lsdr 5dtD3ZQlunFPNAMOxAk53nj+2H2GZ5FprG3rogEA/XqllFx76ZT1hEmQ2Vzi/VQq JfWm9mEG2IKgQ/4Pp8IFPVYFN/vPcv11Z9EWnK1aJhXx/5+idFCNDYAUivhlrAJ0 0O0N56/2fbIcLaWuxUIrTznoJnu1fTG+hRDEV7W6j/bAAI0QNCVASz0IHtmuqohl w== From: Alejandro Jimenez To: qemu-devel@nongnu.org Cc: ethan.milon@eviden.com, mst@redhat.com, pbonzini@redhat.com, mjt@tls.msk.ru, marcel.apfelbaum@gmail.com, richard.henderson@linaro.org, eduardo@habkost.net, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, santosh.shukla@amd.com, sarunkod@amd.com, brijesh.singh@amd.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, alejandro.j.jimenez@oracle.com, philmd@linaro.org Subject: [PATCH v4 1/8] amd_iommu: Fix Miscellaneous Information Register 0 encoding Date: Tue, 17 Jun 2025 15:04:20 +0000 Message-ID: <20250617150427.20585-2-alejandro.j.jimenez@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> References: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-17_06,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2506170117 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjE3MDExOCBTYWx0ZWRfX7+GJzZSbpBGm GMSn8KSAyLa5X0tCwiZUB/rLvEkF64FKIxj1VxLSGGLfOV1pjGLzriWkofPsN0Vnoy5fycUejh9 DHEqSl7+9X+u8HsdG+huP/CM8fvUfoVc1L71vS6FQyp79JN7USHhVccOyPZj+6NhVTryoT7O270 ZbegtDELf1NXYYX4VkdvslTx7cvHPZwOoQJF2jKQ+5KE7LCp+ukw9hIx+JRlu45Esy397uVwUmJ f4g5moyqaFDB0lvnSZc86pBcrJiio8A3XQ8atycsbOAlly1HHwA06Nzq/5ouUpVHEz99pozSkKs M4P1EAZbK5IVYpWJqPgfknlXIcIY3HRM0v/yUcFIYzjB5f1cmZvOCKs/6AfDJ2epN9sCDbotpwc jaau7T8uRaKl3wrdB8g/19UarqpnwTWhLmtWjk5IaqOP4rynX9AtkHJ/0CjTBdH0IUm/XuCL X-Authority-Analysis: v=2.4 cv=U4CSDfru c=1 sm=1 tr=0 ts=685183fe b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6IFa9wvqVegA:10 a=69wJf7TsAAAA:8 a=3GnX9RwCAAAA:8 a=yPCof4ZbAAAA:8 a=zUuKy9m3MhjO6OJNN2oA:9 a=Fg1AiH1G6rFz08G2ETeA:22 a=RF-RJRjNljZ93lortB_0:22 cc=ntf awl=host:13206 X-Proofpoint-GUID: P_YT3rtlxZfKXLGmQSOCej4tLboYNUcM X-Proofpoint-ORIG-GUID: P_YT3rtlxZfKXLGmQSOCej4tLboYNUcM 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=205.220.177.32; envelope-from=alejandro.j.jimenez@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @oracle.com) X-ZM-MESSAGEID: 1750175068293116600 Content-Type: text/plain; charset="utf-8" The definitions encoding the maximum Virtual, Physical, and Guest Virtual Address sizes supported by the IOMMU are using incorrect offsets i.e. the VASize and GVASize offsets are switched. The value in the GVAsize field is also modified, since it was incorrectly encoded. Cc: qemu-stable@nongnu.org Fixes: d29a09ca6842 ("hw/i386: Introduce AMD IOMMU") Co-developed-by: Ethan MILON Signed-off-by: Ethan MILON Signed-off-by: Alejandro Jimenez Reviewed-by: Vasant Hegde --- hw/i386/amd_iommu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 5672bdef89071..3b1d2e9da5347 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -196,9 +196,9 @@ #define AMDVI_PAGE_SHIFT_4K 12 #define AMDVI_PAGE_MASK_4K (~((1ULL << AMDVI_PAGE_SHIFT_4K) - 1)) =20 -#define AMDVI_MAX_VA_ADDR (48UL << 5) -#define AMDVI_MAX_PH_ADDR (40UL << 8) -#define AMDVI_MAX_GVA_ADDR (48UL << 15) +#define AMDVI_MAX_GVA_ADDR (2UL << 5) +#define AMDVI_MAX_PH_ADDR (40UL << 8) +#define AMDVI_MAX_VA_ADDR (48UL << 15) =20 /* Completion Wait data size */ #define AMDVI_COMPLETION_DATA_SIZE 8 --=20 2.43.5 From nobody Sat Nov 15 14:11:19 2025 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1750175060; cv=none; d=zohomail.com; s=zohoarc; b=HsKqzmOWeoDHsM/PMocWVBLnedoINMRe+1P3cXG3qczrhoEB9M6ooA4tuv6e6Y8pIzsPwX2lfnN1jpYeOL2zF5aOYUBQIxHL7YrVmktSHtaXqJwc2CIPiG4VBFK730L7RnSDI54/jOFDvxI1zmo36ciN3L305gwgOsN/wSmuJ30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750175060; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Qd9ckDpIfzkSXuwON6JL4VOurKp58Q4gTqJb6IkYUVk=; b=EvL6k8DuGpZtVfZRbwx7ijUXyJ44+pTv4oUfAXB/wi4Td/uxxcVtOX7mqbrwVIoiYugN+UDUX1JD8HneAAAMMdDFUOsG0I9D2NgDjN4SzurDroOo1AWVRscj3bPBXlkRS4Wdun5KTKEBEtnaztugsbpocy2wCTG4djoxVuVPqxE= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750175060457698.0725640958194; Tue, 17 Jun 2025 08:44:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uRYJ7-0002hQ-BE; Tue, 17 Jun 2025 11:33:05 -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 1uRYI8-0001BQ-SQ for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:32:05 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uRXrZ-0006sL-Na for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:04:40 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEWwa9003868; Tue, 17 Jun 2025 15:04:31 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 478yv55eya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:30 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEFnN2000824; Tue, 17 Jun 2025 15:04:30 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 478yh9bxrk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:30 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 55HF4Svb014869; Tue, 17 Jun 2025 15:04:29 GMT Received: from alaljimee5bm-ol9-20250405.osdevelopmeniad.oraclevcn.com (alaljimee5bm-ol9-20250405.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.254.235]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 478yh9bxny-3; Tue, 17 Jun 2025 15:04:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=Qd9ck DpIfzkSXuwON6JL4VOurKp58Q4gTqJb6IkYUVk=; b=kQN/OEKN3y/cibA07WucM thDgENgc1sQwyDorgoXMtr6TKIbso362CVZsiF9e9HH6yCHiYAdTzu5dXFk7X0/7 nhr9mq0vDNbW8QMePL5OAGu6rMUm7A7YCRDOHFJOgNrNB1wMF2irmsNsK6Tmmpa4 +ctoksftRKHrJuthlNvwN9te1lcrlYDGQzH4bObtuJJo4rr4NonZLfBwHM43BAWh PK3k/M8qVUyuaRCAgNv6BiFHPCayYLIK8QjtGe2VzD53N9gGsCmWgcpOrHCoZVEi 8niMMf5p9s0XLC8A723JRrfAor3Db8wUNKB8S3c0WF53bn50AV5N4XLfBq9d6YJ/ Q== From: Alejandro Jimenez To: qemu-devel@nongnu.org Cc: ethan.milon@eviden.com, mst@redhat.com, pbonzini@redhat.com, mjt@tls.msk.ru, marcel.apfelbaum@gmail.com, richard.henderson@linaro.org, eduardo@habkost.net, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, santosh.shukla@amd.com, sarunkod@amd.com, brijesh.singh@amd.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, alejandro.j.jimenez@oracle.com, philmd@linaro.org Subject: [PATCH v4 2/8] amd_iommu: Fix Device ID decoding for INVALIDATE_IOTLB_PAGES command Date: Tue, 17 Jun 2025 15:04:21 +0000 Message-ID: <20250617150427.20585-3-alejandro.j.jimenez@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> References: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-17_06,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2506170117 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjE3MDExOCBTYWx0ZWRfX0UJjT1+9fASP KXWmrJEtB+qSqvWSblfFNSO93cH0lj7KzI2DNEItGfS7a6TEu52UrO1qSY89JcItG2Fs2Xh+Krh Vm0+Wpu0E0b8Pv7PazrBre7EbDk23HKLUJ2voxEcledoQ1XYemvEfcd14r+g6hOiPuJAmQa0bSV cH0iT0CkRsPk4/rnXA/gRlk94gWvyCR8uIulQnnDVzegdVF1TFQ0ILFEK068DwmAPP9FSZ0ldRi OTqaArtMzxpV+6C2tcuTpB5qF+ZJ/WiNY2G5+ga+MYQPjEVqHwHiN+hMwCHpJMF3xPFSmIJxNEB XwHY82UrJqScCHk3LwrzJyjjky1GcYzDsaVNWYqEjJ2NIk8C6Fc8ZfJGNXHQhO442tXYJAZ8vOa B/2BdW/8UpnBlxbSS2ehDvAey8C+kuFqcwSKOH9aH+EfQwQYxq8VdYaGFBs0LN98GHhB7O8b X-Proofpoint-GUID: dxIiQUF7QYvFYKdmEryGF2p4zBU6QoO4 X-Proofpoint-ORIG-GUID: dxIiQUF7QYvFYKdmEryGF2p4zBU6QoO4 X-Authority-Analysis: v=2.4 cv=W9c4VQWk c=1 sm=1 tr=0 ts=685183fe b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6IFa9wvqVegA:10 a=69wJf7TsAAAA:8 a=yPCof4ZbAAAA:8 a=zd2uoN0lAAAA:8 a=r9zmrm_j51NoiylAmAIA:9 a=Fg1AiH1G6rFz08G2ETeA:22 cc=ntf awl=host:13206 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=205.220.177.32; envelope-from=alejandro.j.jimenez@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @oracle.com) X-ZM-MESSAGEID: 1750175062259116600 Content-Type: text/plain; charset="utf-8" The DeviceID bits are extracted using an incorrect offset in the call to amdvi_iotlb_remove_page(). This field is read (correctly) earlier, so use the value already retrieved for devid. Cc: qemu-stable@nongnu.org Fixes: d29a09ca6842 ("hw/i386: Introduce AMD IOMMU") Signed-off-by: Alejandro Jimenez Reviewed-by: Vasant Hegde --- hw/i386/amd_iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 963aa2450c997..c27efa504d19a 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -508,7 +508,7 @@ static void amdvi_inval_inttable(AMDVIState *s, uint64_= t *cmd) static void iommu_inval_iotlb(AMDVIState *s, uint64_t *cmd) { =20 - uint16_t devid =3D extract64(cmd[0], 0, 16); + uint16_t devid =3D cpu_to_le16(extract64(cmd[0], 0, 16)); if (extract64(cmd[1], 1, 1) || extract64(cmd[1], 3, 1) || extract64(cmd[1], 6, 6)) { amdvi_log_illegalcom_error(s, extract64(cmd[0], 60, 4), @@ -521,7 +521,7 @@ static void iommu_inval_iotlb(AMDVIState *s, uint64_t *= cmd) &devid); } else { amdvi_iotlb_remove_page(s, cpu_to_le64(extract64(cmd[1], 12, 52)) = << 12, - cpu_to_le16(extract64(cmd[1], 0, 16))); + devid); } trace_amdvi_iotlb_inval(); } --=20 2.43.5 From nobody Sat Nov 15 14:11:19 2025 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1750174749; cv=none; d=zohomail.com; s=zohoarc; b=KdcMYzmwSXdlGhBsN/BNK7TEljcowvM3NnNMNbZD5ffIVPLKG9GDYtKTB4OxvwVkh2w+nOfog3JxWs+zDkIVoitlXnbqyDHcAgEwgWEGVuTvPZ0ydjhP/xHQfoutq4wAT5T7yJJI5J/BlDdtlBuBCooxZ7rJY8htnb6xulaTP0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750174749; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=J5iTwp1bSL6P4EyZpSZa9apeAQ6mvJhF3sO7MRLqVsM=; b=Aox9OwGfeimDDRanMlj+F3FAKmEP3ZWBEpOLrh3rH+54l6F74UhJ6s4xE3G+5f20Xa1VutaYXkg9bXQW6fSr/h4v7F39YzVHiKUZLqvC9X26xXA89Mtl18n3q2b3D3TcNGN0mTqTbT0MEHr2cReICUASpPvuqNKOaNIJwpY/bWg= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750174749380852.3465738447397; Tue, 17 Jun 2025 08:39:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uRYKG-0004Cu-PX; Tue, 17 Jun 2025 11:34:18 -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 1uRYI8-000126-P3 for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:32:04 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uRXrZ-0006sN-MO for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:04:41 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEWwdP003883; Tue, 17 Jun 2025 15:04:31 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 478yv55eyb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:31 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEP5mt001490; Tue, 17 Jun 2025 15:04:30 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 478yh9bxsd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:30 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 55HF4Svd014869; Tue, 17 Jun 2025 15:04:30 GMT Received: from alaljimee5bm-ol9-20250405.osdevelopmeniad.oraclevcn.com (alaljimee5bm-ol9-20250405.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.254.235]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 478yh9bxny-4; Tue, 17 Jun 2025 15:04:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=J5iTw p1bSL6P4EyZpSZa9apeAQ6mvJhF3sO7MRLqVsM=; b=mZ/lstljk0s+xDO9cxxoe fneR8d13kX3S3SIMJdiRumWiYhQIWwryPhTE0vSM5bwBMHL9K3HIRdwmKy2ZJE+s j8Pqc6Oo2fspyHPTlelOlGyQ3iaJqLxVMArPeTUd38BXYXQXiP8lqlDASCa+4Lez NF36CjMmy5+w/4va+wZA9Gc7QOaMUacHHnxh1Osm7y1I/yR0kvOHf0bgM4zbd6+a Taqnf4STHUUA4HSiPQjM7ltNaeT1Xmonf4TvndQyBII9HIa9NqkkJk6lK0lCDRY/ t4Nzv9PYTdH9XGetektcuSYo1+xwP2illEyadw0BttpgRe9WqkXLjmGCqYZR6hWv g== From: Alejandro Jimenez To: qemu-devel@nongnu.org Cc: ethan.milon@eviden.com, mst@redhat.com, pbonzini@redhat.com, mjt@tls.msk.ru, marcel.apfelbaum@gmail.com, richard.henderson@linaro.org, eduardo@habkost.net, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, santosh.shukla@amd.com, sarunkod@amd.com, brijesh.singh@amd.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, alejandro.j.jimenez@oracle.com, philmd@linaro.org Subject: [PATCH v4 3/8] amd_iommu: Update bitmasks representing DTE reserved fields Date: Tue, 17 Jun 2025 15:04:22 +0000 Message-ID: <20250617150427.20585-4-alejandro.j.jimenez@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> References: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-17_06,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2506170117 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjE3MDExOCBTYWx0ZWRfX40nnEagjNv9p OtzVpw9Zo8lCzN3uLLf6PINaOxCq3KR4lvrR9dMEdlpk8NI2sjaA8PfciOplci8W4qaiVTLiW4U OoxakaAP6eYSW4E5/7crurKvTmF0r6Qs3pQgsZlbeI0LL7iqvGsA67Uog3DZq6YDvXSbUV/RMZK IzQMsCNJat4YBXRD5vkEgGrl5oJnNinWXsrZodyNNYZOHATLgFZYriz5qG7Yj/tsl7AvYKn7dvO tzz29vkk/Dachg/I5Q0/HU4lmFu49zOTScvuQDfrkq2G5i5JeoWbshT9oeB5m/6D3XJ5JAMNpc9 5X9UKlTrj4FmB1cUghyXizMbmlADa8GwdcxdXIG2sgLnCsHyZHxswWH55oMCQiynarGvKnFWtmW vuQITRpJt6ZpmGruMIIvj+jD2sUR2EuHOPal6cZSw/0BZ2jXoPRInp9TU/yYBIzDTJN8Np9o X-Proofpoint-GUID: rpsIem4wlp0C6wLL0rJ8ZiFuWjTkIa7R X-Proofpoint-ORIG-GUID: rpsIem4wlp0C6wLL0rJ8ZiFuWjTkIa7R X-Authority-Analysis: v=2.4 cv=W9c4VQWk c=1 sm=1 tr=0 ts=685183ff b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6IFa9wvqVegA:10 a=69wJf7TsAAAA:8 a=yPCof4ZbAAAA:8 a=zd2uoN0lAAAA:8 a=4jmliWysXe4-JJ31YZsA:9 a=Fg1AiH1G6rFz08G2ETeA:22 cc=ntf awl=host:13206 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=205.220.177.32; envelope-from=alejandro.j.jimenez@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @oracle.com) X-ZM-MESSAGEID: 1750174751828116600 Content-Type: text/plain; charset="utf-8" The DTE validation method verifies that all bits in reserved DTE fields are unset. Update them according to the latest definition available in AMD I/O Virtualization Technology (IOMMU) Specification - Section 2.2.2.1 Device Table Entry Format. Remove the magic numbers and use a macro helper to generate bitmasks covering the specified ranges for better legibility. Note that some reserved fields specify that events are generated when they contain non-zero bits, or checks are skipped under certain configurations. This change only updates the reserved masks, checks for special conditions are not yet implemented. Cc: qemu-stable@nongnu.org Signed-off-by: Alejandro Jimenez Reviewed-by: Vasant Hegde --- hw/i386/amd_iommu.c | 7 ++++--- hw/i386/amd_iommu.h | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index c27efa504d19a..6e78047919cb6 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -848,9 +848,10 @@ static inline uint64_t amdvi_get_perms(uint64_t entry) static bool amdvi_validate_dte(AMDVIState *s, uint16_t devid, uint64_t *dte) { - if ((dte[0] & AMDVI_DTE_LOWER_QUAD_RESERVED) - || (dte[1] & AMDVI_DTE_MIDDLE_QUAD_RESERVED) - || (dte[2] & AMDVI_DTE_UPPER_QUAD_RESERVED) || dte[3]) { + if ((dte[0] & AMDVI_DTE_QUAD0_RESERVED) || + (dte[1] & AMDVI_DTE_QUAD1_RESERVED) || + (dte[2] & AMDVI_DTE_QUAD2_RESERVED) || + (dte[3] & AMDVI_DTE_QUAD3_RESERVED)) { amdvi_log_illegaldevtab_error(s, devid, s->devtab + devid * AMDVI_DEVTAB_ENTRY_SIZE, 0); diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 3b1d2e9da5347..aacb29b617aec 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -25,6 +25,8 @@ #include "hw/i386/x86-iommu.h" #include "qom/object.h" =20 +#define GENMASK64(h, l) (((~0ULL) >> (63 - (h) + (l))) << (l)) + /* Capability registers */ #define AMDVI_CAPAB_BAR_LOW 0x04 #define AMDVI_CAPAB_BAR_HIGH 0x08 @@ -162,9 +164,10 @@ #define AMDVI_FEATURE_PC (1ULL << 9) /* Perf counters = */ =20 /* reserved DTE bits */ -#define AMDVI_DTE_LOWER_QUAD_RESERVED 0x80300000000000fc -#define AMDVI_DTE_MIDDLE_QUAD_RESERVED 0x0000000000000100 -#define AMDVI_DTE_UPPER_QUAD_RESERVED 0x08f0000000000000 +#define AMDVI_DTE_QUAD0_RESERVED (GENMASK64(6, 2) | GENMASK64(63, 6= 3)) +#define AMDVI_DTE_QUAD1_RESERVED 0 +#define AMDVI_DTE_QUAD2_RESERVED GENMASK64(53, 52) +#define AMDVI_DTE_QUAD3_RESERVED (GENMASK64(14, 0) | GENMASK64(53, = 48)) =20 /* AMDVI paging mode */ #define AMDVI_GATS_MODE (2ULL << 12) --=20 2.43.5 From nobody Sat Nov 15 14:11:19 2025 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1750174761; cv=none; d=zohomail.com; s=zohoarc; b=loRs1kgEGzs30/1Xshdi73b55R4L6xVHt3NWWxSzCFsEeq9eUI4F7XIH/MgdYy3SyhcqEPMYE9hhhfmzWIp3t2sxcAnQMAZ8hRAqFRzy85Q2Kj2joZtMdjaxSVW+/8Zj0/pZmuujahjfJoUgT2oILc4Zvm8H9lZDMYgpuOj6ONU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750174761; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hnK14NSncMR/M7NA29/0z4zuv66VAbToBpQ0LVKOuYE=; b=gd1CcDj59yoL/GWljuzOHdSXg7okTASsxjGnfMpIWIRqT6Z3wrinw7JtdAoEtCcOz2kNvpkiQyK1LlkpoKxBkG5Fl3nKiIlyjVK5TeIBu4B9kJbIVcXwULJWFMw3WMw5VaALnjCMq2zYsHMiEQVWrfiLBS/q2lR7iFkENI4spuM= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750174761904487.8820681496976; Tue, 17 Jun 2025 08:39:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uRYJ1-0002Ua-JU; Tue, 17 Jun 2025 11:32:59 -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 1uRYI7-0001Fx-Sq for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:32:04 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uRXrb-0006sY-Q8 for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:04:41 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEX1kC003995; Tue, 17 Jun 2025 15:04:32 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 478yv55eyd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:32 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEKQPs000872; Tue, 17 Jun 2025 15:04:31 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 478yh9bxsw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:31 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 55HF4Svf014869; Tue, 17 Jun 2025 15:04:30 GMT Received: from alaljimee5bm-ol9-20250405.osdevelopmeniad.oraclevcn.com (alaljimee5bm-ol9-20250405.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.254.235]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 478yh9bxny-5; Tue, 17 Jun 2025 15:04:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=hnK14 NSncMR/M7NA29/0z4zuv66VAbToBpQ0LVKOuYE=; b=F0OOm+v8oJ7bgomGlnn1D qdj6ASxwGuDg738VV+qj2Lp5P9nyPGhFGswWdlBe8N7fxIpdNtGdUz4nfF6Hyq6Q Dog+/AYNm8196qgAFQiRWUQ+v/IWYyF+h7lnfmbRohlNQ5qK7CoPPZxdN25Zh1hA grfLe8o3ZUZhSSHDMrrehzi8Tqpj/kUDWcnoRyhv3wKzvSaL0OHbvvg+syErQRay dW1wXG2zTA3whXl+hOpABPb7bfb1jZshKULG7DYgepBOTgBUBHObQO8IVWGnTpcs yJp4v8IHGxvnGaBqYxr+bMU2bSl821ESQsJdaI/bmBJHP/GhzIv5DSMomCH2TtMr w== From: Alejandro Jimenez To: qemu-devel@nongnu.org Cc: ethan.milon@eviden.com, mst@redhat.com, pbonzini@redhat.com, mjt@tls.msk.ru, marcel.apfelbaum@gmail.com, richard.henderson@linaro.org, eduardo@habkost.net, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, santosh.shukla@amd.com, sarunkod@amd.com, brijesh.singh@amd.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, alejandro.j.jimenez@oracle.com, philmd@linaro.org Subject: [PATCH v4 4/8] amd_iommu: Fix masks for various IOMMU MMIO Registers Date: Tue, 17 Jun 2025 15:04:23 +0000 Message-ID: <20250617150427.20585-5-alejandro.j.jimenez@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> References: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-17_06,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2506170117 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjE3MDExOCBTYWx0ZWRfX6Ry377NW1TH4 vREryrsiokI19VhS9lLSmikeCsLr/gfDfkwOSVy4VQTrVsMZSSmgWVqRIS4ml/o1yoPH9twMxXK uEmBHTJWLAk4e8XG4hRrQz47q3xEFlV3AaAVep+weQiNtOCKYo+ZkQxXvY/9Zto4wBOd5m2G8TL dBs3yjL6q07C/h2DAR+MV26tf30sPyomfdNhsgbHK3BFKoWrCPIPD6ep6BBwOv8gR9/gGMB9TXY sU+iTksGvW/1mkgsLYRnniK0Ol4QhXE7wSHZS9Bg/rTuO7li6tufanCUUyPoeTZL+R4IN00SCD7 o4Sz1goM/aU/6Z5XBHk3VzxfQL662SqRV/faRtPx4FXE5C7FIDQ1GFn89dyHEXCNUsBdY1YFwfe eVG3U7zbBCA96mRUnP0XwzmShWRNsd0W3hDDsv/kNGfJILarWEPEySlP3dLg27jltZoO7rLH X-Proofpoint-GUID: MHXJIC3fdcSG3rMdbWEQ6jAo2xTO_8lG X-Proofpoint-ORIG-GUID: MHXJIC3fdcSG3rMdbWEQ6jAo2xTO_8lG X-Authority-Analysis: v=2.4 cv=W9c4VQWk c=1 sm=1 tr=0 ts=68518400 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6IFa9wvqVegA:10 a=69wJf7TsAAAA:8 a=yPCof4ZbAAAA:8 a=zd2uoN0lAAAA:8 a=x93to4iw_sD-aHtwAakA:9 a=Fg1AiH1G6rFz08G2ETeA:22 cc=ntf awl=host:13206 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=205.220.177.32; envelope-from=alejandro.j.jimenez@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UPPERCASE_50_75=0.008 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @oracle.com) X-ZM-MESSAGEID: 1750174764027116600 Content-Type: text/plain; charset="utf-8" Address various issues with definitions of the MMIO registers e.g. for the Device Table Address Register, the size mask currently encompasses reserved bits [11:9], so change it to only extract the bits [8:0] encoding size. Convert masks to use GENMASK64 for consistency, and make unrelated definitions independent. Cc: qemu-stable@nongnu.org Fixes: d29a09ca6842 ("hw/i386: Introduce AMD IOMMU") Signed-off-by: Alejandro Jimenez Reviewed-by: Vasant Hegde --- hw/i386/amd_iommu.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index aacb29b617aec..988a485f808cc 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -68,34 +68,34 @@ =20 #define AMDVI_MMIO_SIZE 0x4000 =20 -#define AMDVI_MMIO_DEVTAB_SIZE_MASK ((1ULL << 12) - 1) -#define AMDVI_MMIO_DEVTAB_BASE_MASK (((1ULL << 52) - 1) & ~ \ - AMDVI_MMIO_DEVTAB_SIZE_MASK) +#define AMDVI_MMIO_DEVTAB_SIZE_MASK GENMASK64(8, 0) +#define AMDVI_MMIO_DEVTAB_BASE_MASK GENMASK64(51, 12) + #define AMDVI_MMIO_DEVTAB_ENTRY_SIZE 32 #define AMDVI_MMIO_DEVTAB_SIZE_UNIT 4096 =20 /* some of this are similar but just for readability */ #define AMDVI_MMIO_CMDBUF_SIZE_BYTE (AMDVI_MMIO_COMMAND_BASE + 7) #define AMDVI_MMIO_CMDBUF_SIZE_MASK 0x0f -#define AMDVI_MMIO_CMDBUF_BASE_MASK AMDVI_MMIO_DEVTAB_BASE_MASK -#define AMDVI_MMIO_CMDBUF_HEAD_MASK (((1ULL << 19) - 1) & ~0x0f) -#define AMDVI_MMIO_CMDBUF_TAIL_MASK AMDVI_MMIO_EVTLOG_HEAD_MASK +#define AMDVI_MMIO_CMDBUF_BASE_MASK GENMASK64(51, 12) +#define AMDVI_MMIO_CMDBUF_HEAD_MASK GENMASK64(18, 4) +#define AMDVI_MMIO_CMDBUF_TAIL_MASK GENMASK64(18, 4) =20 #define AMDVI_MMIO_EVTLOG_SIZE_BYTE (AMDVI_MMIO_EVENT_BASE + 7) -#define AMDVI_MMIO_EVTLOG_SIZE_MASK AMDVI_MMIO_CMDBUF_SIZE_MASK -#define AMDVI_MMIO_EVTLOG_BASE_MASK AMDVI_MMIO_CMDBUF_BASE_MASK -#define AMDVI_MMIO_EVTLOG_HEAD_MASK (((1ULL << 19) - 1) & ~0x0f) -#define AMDVI_MMIO_EVTLOG_TAIL_MASK AMDVI_MMIO_EVTLOG_HEAD_MASK +#define AMDVI_MMIO_EVTLOG_SIZE_MASK 0x0f +#define AMDVI_MMIO_EVTLOG_BASE_MASK GENMASK64(51, 12) +#define AMDVI_MMIO_EVTLOG_HEAD_MASK GENMASK64(18, 4) +#define AMDVI_MMIO_EVTLOG_TAIL_MASK GENMASK64(18, 4) =20 -#define AMDVI_MMIO_PPRLOG_SIZE_BYTE (AMDVI_MMIO_EVENT_BASE + 7) -#define AMDVI_MMIO_PPRLOG_HEAD_MASK AMDVI_MMIO_EVTLOG_HEAD_MASK -#define AMDVI_MMIO_PPRLOG_TAIL_MASK AMDVI_MMIO_EVTLOG_HEAD_MASK -#define AMDVI_MMIO_PPRLOG_BASE_MASK AMDVI_MMIO_EVTLOG_BASE_MASK -#define AMDVI_MMIO_PPRLOG_SIZE_MASK AMDVI_MMIO_EVTLOG_SIZE_MASK +#define AMDVI_MMIO_PPRLOG_SIZE_BYTE (AMDVI_MMIO_PPR_BASE + 7) +#define AMDVI_MMIO_PPRLOG_SIZE_MASK 0x0f +#define AMDVI_MMIO_PPRLOG_BASE_MASK GENMASK64(51, 12) +#define AMDVI_MMIO_PPRLOG_HEAD_MASK GENMASK64(18, 4) +#define AMDVI_MMIO_PPRLOG_TAIL_MASK GENMASK64(18, 4) =20 #define AMDVI_MMIO_EXCL_ENABLED_MASK (1ULL << 0) #define AMDVI_MMIO_EXCL_ALLOW_MASK (1ULL << 1) -#define AMDVI_MMIO_EXCL_LIMIT_MASK AMDVI_MMIO_DEVTAB_BASE_MASK +#define AMDVI_MMIO_EXCL_LIMIT_MASK GENMASK64(51, 12) #define AMDVI_MMIO_EXCL_LIMIT_LOW 0xfff =20 /* mmio control register flags */ @@ -132,14 +132,14 @@ #define AMDVI_DEV_TRANSLATION_VALID (1ULL << 1) #define AMDVI_DEV_MODE_MASK 0x7 #define AMDVI_DEV_MODE_RSHIFT 9 -#define AMDVI_DEV_PT_ROOT_MASK 0xffffffffff000 +#define AMDVI_DEV_PT_ROOT_MASK GENMASK64(51, 12) #define AMDVI_DEV_PT_ROOT_RSHIFT 12 #define AMDVI_DEV_PERM_SHIFT 61 #define AMDVI_DEV_PERM_READ (1ULL << 61) #define AMDVI_DEV_PERM_WRITE (1ULL << 62) =20 /* Device table entry bits 64:127 */ -#define AMDVI_DEV_DOMID_ID_MASK ((1ULL << 16) - 1) +#define AMDVI_DEV_DOMID_ID_MASK GENMASK64(15, 0) =20 /* Event codes and flags, as stored in the info field */ #define AMDVI_EVENT_ILLEGAL_DEVTAB_ENTRY (0x1U << 12) @@ -197,7 +197,7 @@ #define AMDVI_PAGE_SIZE (1ULL << AMDVI_PAGE_SHIFT) =20 #define AMDVI_PAGE_SHIFT_4K 12 -#define AMDVI_PAGE_MASK_4K (~((1ULL << AMDVI_PAGE_SHIFT_4K) - 1)) +#define AMDVI_PAGE_MASK_4K GENMASK64(63, 12) =20 #define AMDVI_MAX_GVA_ADDR (2UL << 5) #define AMDVI_MAX_PH_ADDR (40UL << 8) --=20 2.43.5 From nobody Sat Nov 15 14:11:19 2025 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1750174366; cv=none; d=zohomail.com; s=zohoarc; b=jxTdd8O7+eTugZqx5Upor3vC/khevWPo6n4Y+71KXRlsCM/PDcAp3c4eMNFyfIdR1uVEH66SU7J339fLcKDZ6oOab7w7VTatTaXZLYJq3r+se/Ji1pVY4VuKqFZPGBsX18kGD6GjHYXtRHGGX+tmbTipORc30pZY+t9GDdfauiw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750174366; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=66pgNYGDKbghLS1TEv4zQ3PHBw3c2sjasWk8q2OjnXQ=; b=ANnOj0xilPw0vS/2de7hyOF0oI2aw758BrP0ZEzbh2/KhYUpKL43blxDly7/EHBUo7tHw0YeiB3p5s74WC3h7sreiL1Kb2lZktLKCyMAOi8EZGkgjVoMvIgzBWq2KcJcuirWN2FqwwAxHDhKjdwIRuy7XiLcW52byidLJ7jJNF4= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750174366558913.4777241399883; Tue, 17 Jun 2025 08:32:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uRYIG-0001Xb-5L; Tue, 17 Jun 2025 11:32:12 -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 1uRYI7-0000vN-KB for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:32:04 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uRXsQ-00076j-RV for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:05:33 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEXDZG012810; Tue, 17 Jun 2025 15:05:14 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 47b23xs0wb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:05:13 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEedae000822; Tue, 17 Jun 2025 15:04:32 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 478yh9bxtj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:32 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 55HF4Svh014869; Tue, 17 Jun 2025 15:04:31 GMT Received: from alaljimee5bm-ol9-20250405.osdevelopmeniad.oraclevcn.com (alaljimee5bm-ol9-20250405.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.254.235]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 478yh9bxny-6; Tue, 17 Jun 2025 15:04:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=66pgN YGDKbghLS1TEv4zQ3PHBw3c2sjasWk8q2OjnXQ=; b=QXmAiipKaphBYq1Khf5+V uWBIJio00GSH8ZS2R5n/gK8fBEOeoWtrp5mkP5gkZMMB0TyiF7eC0/Jn8kWSpbXR sZ48lI9AOR2c8AQbXb0PBhiBgn6Ne7oGvc05YHwyHyfuDOxlPZFAaypwedQKkQO+ 5Y08uTGHWAcCn5lXM/lC8eBo4P+LDch7/DDGFe4d7kBdLrK2Y33fvEdWiGux9nlg Hc2mTLhPn2Y27xslian3cRFiit5jRxPO0cPYfcSGB0C66iERpfGYPiDKrYkbAUc5 nYTvBx0ZSG4ectg7xaJNRBheDlPoKDCVmyhy7XOgFXl8ssIl9Mwt4XBd2Bmzg78k g== From: Alejandro Jimenez To: qemu-devel@nongnu.org Cc: ethan.milon@eviden.com, mst@redhat.com, pbonzini@redhat.com, mjt@tls.msk.ru, marcel.apfelbaum@gmail.com, richard.henderson@linaro.org, eduardo@habkost.net, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, santosh.shukla@amd.com, sarunkod@amd.com, brijesh.singh@amd.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, alejandro.j.jimenez@oracle.com, philmd@linaro.org Subject: [PATCH v4 5/8] amd_iommu: Fix mask to retrieve Interrupt Table Root Pointer from DTE Date: Tue, 17 Jun 2025 15:04:24 +0000 Message-ID: <20250617150427.20585-6-alejandro.j.jimenez@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> References: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-17_06,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2506170117 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjE3MDExOCBTYWx0ZWRfX9lvUNp3uq9Ui Uhk5B9Y35QV47FIWRKbEmQ/YgE0oA9aeoph5CAJcTglxoBNuznHY4lLRsCHDPz8Bs8sdkOuTOBB zBAil2mE1dUNYHI8kWm1267U06W/uWLuht8tyQxW9cVx2nhdPWu+7nfhV8NdHtM4GdIS0m7ls1/ 0lk5xdJ8IBaXT21MURo5O95rotpTbgMLvvhX7VnxC/Za8113dOuIhEGKipuLjfERpwUey/f74RF VKiBOy3pVJw4M7LnqUn7IasmwDwzSBeK755W0AkPMVAbL4tdgMB0gMYBCyyi/tSSbN94M9SYs52 nj2zzhKZToQceku/5m9B959bBFzlmj8nuswtRuTb+6TUd/UJqu307xZpni5RTIHfI4hB1fViy35 fOtC8c13CyTuaJOu8Imf+OkPkXvWXxzSbAoiP03uvWvLD4MTn2sHsGEZS7YhBrIiJSFhD76+ X-Authority-Analysis: v=2.4 cv=DM2P4zNb c=1 sm=1 tr=0 ts=68518429 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6IFa9wvqVegA:10 a=69wJf7TsAAAA:8 a=yPCof4ZbAAAA:8 a=zd2uoN0lAAAA:8 a=VXbWx-IoamzKqho_xYMA:9 a=Fg1AiH1G6rFz08G2ETeA:22 cc=ntf awl=host:13206 X-Proofpoint-GUID: Cg3HqFDKm4r5zuNbANtCHWJxyFafQj_s X-Proofpoint-ORIG-GUID: Cg3HqFDKm4r5zuNbANtCHWJxyFafQj_s 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=205.220.165.32; envelope-from=alejandro.j.jimenez@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @oracle.com) X-ZM-MESSAGEID: 1750174369375116600 Content-Type: text/plain; charset="utf-8" Fix an off-by-one error in the definition of AMDVI_IR_PHYS_ADDR_MASK. The current definition masks off the most significant bit of the Interrupt Table Root ptr i.e. it only generates a mask with bits [50:6] set. See the AMD I/O Virtualization Technology (IOMMU) Specification for the Interrupt Table Root Pointer[51:6] field in the Device Table Entry format. Cc: qemu-stable@nongnu.org Fixes: b44159fe0078 ("x86_iommu/amd: Add interrupt remap support when VAPIC= is not enabled") Signed-off-by: Alejandro Jimenez Reviewed-by: Vasant Hegde --- hw/i386/amd_iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 988a485f808cc..96fc5b621e609 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -231,7 +231,7 @@ #define AMDVI_IR_INTCTL_PASS 1 #define AMDVI_IR_INTCTL_REMAP 2 =20 -#define AMDVI_IR_PHYS_ADDR_MASK (((1ULL << 45) - 1) << 6) +#define AMDVI_IR_PHYS_ADDR_MASK GENMASK64(51, 6) =20 /* MSI data 10:0 bits (section 2.2.5.1 Fig 14) */ #define AMDVI_IRTE_OFFSET 0x7ff --=20 2.43.5 From nobody Sat Nov 15 14:11:19 2025 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1750174488; cv=none; d=zohomail.com; s=zohoarc; b=WQNmd9j+kRmp3o0CHwhjI9vU8BahdDWuNFVeF5g3UYgiUV69ln+xzTiFib/FmBLREvDycUFqaF3ixUsEdZwBjhiektOCjhSaS/EuEkhSKOIvyyUxz4o/0FNmTc8n9UG5/iDHGQxlbkK5j7I8oh3zCpa9tCdHByL+OJNZAHi/aVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750174488; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ojikVWLUMcBpn4btb2F8/5qEmOrVoouT7d65GKlF7H0=; b=cVEuDaojrEFJWFVyLVvYHWMzGaSOkyKAyL+c4+Jn5h+q5FxPHAVITOdN2mi7lB2Glt/c4XZHeJ/w32MoC72MdVHFtNCvSZI6Z6T56A5qtuPXOz26kJjjij4lO9a/v1lQ1IOVkJTsCJo6CCvr1ksM9ReDNm/LIHF09vOwP04U2dE= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750174488159588.6314421249298; Tue, 17 Jun 2025 08:34:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uRYIn-0001vW-NG; Tue, 17 Jun 2025 11:32:46 -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 1uRYI7-00015x-Rg for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:32:04 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uRXrb-0006sb-3Y for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:04:41 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEWwUj004226; Tue, 17 Jun 2025 15:04:33 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 479q8r4k0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:33 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEFnN4000824; Tue, 17 Jun 2025 15:04:32 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 478yh9bxu3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:32 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 55HF4Svj014869; Tue, 17 Jun 2025 15:04:32 GMT Received: from alaljimee5bm-ol9-20250405.osdevelopmeniad.oraclevcn.com (alaljimee5bm-ol9-20250405.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.254.235]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 478yh9bxny-7; Tue, 17 Jun 2025 15:04:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=ojikV WLUMcBpn4btb2F8/5qEmOrVoouT7d65GKlF7H0=; b=JAqPxs+LM0mz8TIJ0FPip 665S/5p3rdQ1IiEX1R8Kl2RRHWYGKu4sEqsHVWyo2O9DUq9jnPJP8zPFyGxxnhyD BWhfe+6qsbp7vEJjzYHHQ8ZOoQF9CGvoZ5yaq4V/+Zudq+S2v+BUntbPmqKh0EK8 Iqjs9FVffbpiQh/wsMQV4S1SgXobxcX2DAIvyhVUvUzTqOVozEbyOWlER2DlVBuR mT9svNHEUN6oN0D/4okK6CmOtxVa9CzGO3Tnkq8wOn3wnNlg2WYwbRw1idsint10 DsYrtDMq+bkNh0xUQfJVIOoGP2dAX3uW3Tf5JEbSagDmdQYSA1lOm99L9Z+lI2Zj g== From: Alejandro Jimenez To: qemu-devel@nongnu.org Cc: ethan.milon@eviden.com, mst@redhat.com, pbonzini@redhat.com, mjt@tls.msk.ru, marcel.apfelbaum@gmail.com, richard.henderson@linaro.org, eduardo@habkost.net, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, santosh.shukla@amd.com, sarunkod@amd.com, brijesh.singh@amd.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, alejandro.j.jimenez@oracle.com, philmd@linaro.org Subject: [PATCH v4 6/8] amd_iommu: Fix the calculation for Device Table size Date: Tue, 17 Jun 2025 15:04:25 +0000 Message-ID: <20250617150427.20585-7-alejandro.j.jimenez@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> References: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-17_06,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2506170117 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjE3MDExOCBTYWx0ZWRfX1XXxatMz+W2J uQNCRqy+QtE5AN9L2D94ntgmbrtZRGbUGAjAckpJeCw/YTlKRGne6Vl3DVPs+9jZNrMajaatNUL /Ps0vraDgT5DQb3qkduCG8O2UFryI/Uha0HCP4xpDbgZojXUtGsCQGdTBlHmtxPdXWzcN6wN4Xo tQFTmyCj8yztliCi/cssVufwvk3bfh6wjcV2SsUZswY2dTFH/PhIPAIipeCGdBAduAtsI1sb+N2 k4lDoidVzDHUxcJdfF1lPH28K+luGipPic+gklwrILNcV4t9ONXXTBcC/Av+6S6qghP+ZihBELH y4ymDdc4xL6EXWoCS8ssxY6Q4zlCXDL39eFCQmvNgy7a9szdSPFn3SFG6cch0v4Mo7dvGN9T0X/ MsrnaY3aS+FMpgGNvvufsuY4Y2+jpVU7rPFE8bTNqdvQ/Hh3NZL0xjBWNY7HvWEcjJqJ5vLe X-Proofpoint-GUID: J_h_sLxTqxYRmLQcF2_LKoCt4dqpUC5a X-Proofpoint-ORIG-GUID: J_h_sLxTqxYRmLQcF2_LKoCt4dqpUC5a X-Authority-Analysis: v=2.4 cv=dvLbC0g4 c=1 sm=1 tr=0 ts=68518401 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6IFa9wvqVegA:10 a=69wJf7TsAAAA:8 a=yPCof4ZbAAAA:8 a=zd2uoN0lAAAA:8 a=r9zmrm_j51NoiylAmAIA:9 a=Fg1AiH1G6rFz08G2ETeA:22 cc=ntf awl=host:13206 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=205.220.177.32; envelope-from=alejandro.j.jimenez@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @oracle.com) X-ZM-MESSAGEID: 1750174488587116600 Content-Type: text/plain; charset="utf-8" Correctly calculate the Device Table size using the format encoded in the Device Table Base Address Register (MMIO Offset 0000h). Cc: qemu-stable@nongnu.org Fixes: d29a09ca6842 ("hw/i386: Introduce AMD IOMMU") Signed-off-by: Alejandro Jimenez Reviewed-by: Vasant Hegde --- hw/i386/amd_iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 6e78047919cb6..92f94dc788c3d 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -665,8 +665,8 @@ static inline void amdvi_handle_devtab_write(AMDVIState= *s) uint64_t val =3D amdvi_readq(s, AMDVI_MMIO_DEVICE_TABLE); s->devtab =3D (val & AMDVI_MMIO_DEVTAB_BASE_MASK); =20 - /* set device table length */ - s->devtab_len =3D ((val & AMDVI_MMIO_DEVTAB_SIZE_MASK) + 1 * + /* set device table length (i.e. number of entries table can hold) */ + s->devtab_len =3D (((val & AMDVI_MMIO_DEVTAB_SIZE_MASK) + 1) * (AMDVI_MMIO_DEVTAB_SIZE_UNIT / AMDVI_MMIO_DEVTAB_ENTRY_SIZE)); } --=20 2.43.5 From nobody Sat Nov 15 14:11:19 2025 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1750174402; cv=none; d=zohomail.com; s=zohoarc; b=eG0m15bgDsaF4RhfMV/jJHB/iPk8oHG+1/T3ep+qdu7eAndp+rNgN8tXViXcktfyPWe4LPEfqbp84+Tb3+3w+JPLNnGeMWlC7z1+pXF08xa4i+fdjwwrjlnKkqGurWBD9l59B6sGT09jZK9HfUoLgz/B2TGIBtl0hO9NUoplURc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750174402; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=o2IXybfL3OSXU+JmZUZLocaE7oeCQq+Wag+BKeIlvCw=; b=Xl1Y+My0P6K04r4KXS5QRwW0sRAU3JP1rOqzuv++KtnyenN32w4JIZgFkko3OaLHuJuQST49vxh4fIcy/2pGaYCHoRazG2mLqzUl0RSd2ep8Hw2YBzuGtjb2H3q06XU92g2aOing4BiOMy4S7kUdjhD1bmQ/J8Xt8Wo2UYWfauI= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750174402441655.0200519926118; Tue, 17 Jun 2025 08:33:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uRYIy-0002NV-4M; Tue, 17 Jun 2025 11:32:56 -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 1uRYI7-0001BQ-S7 for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:32:04 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uRXrn-0006tn-4q for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:04:52 -0400 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEXDjA013192; Tue, 17 Jun 2025 15:04:36 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4790yd5h67-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:36 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 55HDjRfi001627; Tue, 17 Jun 2025 15:04:33 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 478yh9bxv1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:33 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 55HF4Svl014869; Tue, 17 Jun 2025 15:04:32 GMT Received: from alaljimee5bm-ol9-20250405.osdevelopmeniad.oraclevcn.com (alaljimee5bm-ol9-20250405.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.254.235]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 478yh9bxny-8; Tue, 17 Jun 2025 15:04:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=o2IXy bfL3OSXU+JmZUZLocaE7oeCQq+Wag+BKeIlvCw=; b=em2FzFGwUszj0gDNc/ZK1 Q9ti6NTYk9Z/PoNrm48ZbST9Tv91uo4AUEWvKvrUUznl0mMkCwGNB22577JxaaVe ZvbuFDCQf4HNIpEAu8z/KWsoRNvFVK/YkgsRgOwoCtdTiOvHjkkj0OLm2qFrFxc5 hrBptaDrwKrEQlW2mlB53ATsSK3k/k3iOrcJZS4ctoa0v6b4c2SK1dujY6yBTfVG FCe7IQOq5yOGiZOIzDngnLy4Ow6nSN0RIsOWYfID5G8f5Rn7IRHaiP4v50WNHqSz nCCLl+JgIl5kUMdoUN3db/PnMJLIyWYPpcd/RjVuOQXUAd1C6gi3jumtlA5iL297 w== From: Alejandro Jimenez To: qemu-devel@nongnu.org Cc: ethan.milon@eviden.com, mst@redhat.com, pbonzini@redhat.com, mjt@tls.msk.ru, marcel.apfelbaum@gmail.com, richard.henderson@linaro.org, eduardo@habkost.net, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, santosh.shukla@amd.com, sarunkod@amd.com, brijesh.singh@amd.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, alejandro.j.jimenez@oracle.com, philmd@linaro.org Subject: [PATCH v4 7/8] amd_iommu: Remove duplicated definitions Date: Tue, 17 Jun 2025 15:04:26 +0000 Message-ID: <20250617150427.20585-8-alejandro.j.jimenez@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> References: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-17_06,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2506170117 X-Proofpoint-GUID: Zxfw7Pj5wxG-VRUDrqhnWJggDT_hbOpW X-Proofpoint-ORIG-GUID: Zxfw7Pj5wxG-VRUDrqhnWJggDT_hbOpW X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjE3MDExOCBTYWx0ZWRfX2FSWH5p4Czid 5D+IypNirxF/nBi/SQmo+0R1+/NmXaFGoHpXUbeO9aDlkP4grTvedYJMoOSzru45EfGYOSZ3cQN tPBlP4ibvp1V9N06U0T7/xoIfWG5tZzNpxLLoyoKB7CXylwXseAqUlYIoAD3J3s3yHSB3zl7N13 lXDv4aEBOTGk5gHrI95y+NdgqQixv31IfRSOfu5qEOHAvgX8hI9MLIdAQoJNZRpjNFX875BNaWd MDe9g+SHAFGPbe3ULkfGyMDiqWLpuY+ShnDtmVtIX8/q5jlFX/Idfv9t9k2hXuh1cessnmE7Otv SGOFjf0wQcWLsw18H7wXYgVc17zaj0q1SnXvfVnvkeb3acQh/qGF2DDwE9OwcwfKKp9zu4SsOH7 Dvtu/CUAXUy8RZ+KaSPOYiwl2+pNF+iuiuoQVwhxMP0/mxYQKfoCfsA1BfPJcrAI6qNfQkFf X-Authority-Analysis: v=2.4 cv=XZGJzJ55 c=1 sm=1 tr=0 ts=68518404 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6IFa9wvqVegA:10 a=yPCof4ZbAAAA:8 a=zd2uoN0lAAAA:8 a=LyhGpKROpydgPnGzpJcA:9 cc=ntf awl=host:13206 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=205.220.165.32; envelope-from=alejandro.j.jimenez@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @oracle.com) X-ZM-MESSAGEID: 1750174403602116600 Content-Type: text/plain; charset="utf-8" No functional change. Signed-off-by: Alejandro Jimenez Reviewed-by: Vasant Hegde --- hw/i386/amd_iommu.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 96fc5b621e609..8b42913ed8dab 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -206,10 +206,6 @@ /* Completion Wait data size */ #define AMDVI_COMPLETION_DATA_SIZE 8 =20 -#define AMDVI_COMMAND_SIZE 16 -/* Completion Wait data size */ -#define AMDVI_COMPLETION_DATA_SIZE 8 - #define AMDVI_COMMAND_SIZE 16 =20 #define AMDVI_INT_ADDR_FIRST 0xfee00000 --=20 2.43.5 From nobody Sat Nov 15 14:11:19 2025 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1750174394; cv=none; d=zohomail.com; s=zohoarc; b=CoPG0sLCOghyVSl0BizX5D4BdT/YzpHKGSE/CodSN5Z6EK15jEkhr4ekHyHtfW+z8wctmfkIAHO3sK2XeAzdnhMkK2FIfRRIqTNcF4060GM3r5RFEGpyrNTX7Rec1piFIYc77VXxd9n+Joc6D0kmeqDUvNLrIbAbjnDqoPlawbI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750174394; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LjaYafom8TafeELPzF4Q5fuqiXlfP0RnnBbZinxkogk=; b=CSAeEWDTDttQ58t0wBF/qMGolUy1xZlhlVNa5ae0GQIKCJccsL1t9eBxs9Ty1xfNxwlyKW6m+HGKYqStFfqrABxJUzsvt+1OedkOBFgAPKuI76jf6sM0+SEI9/l8PdvYlZbQAYb/h9cdnvhR4J970Qi0BunpTIkXfOOpjb6P5Sg= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175017439454932.69969346457958; Tue, 17 Jun 2025 08:33:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uRYIv-0002E9-Jk; Tue, 17 Jun 2025 11:32:53 -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 1uRYI7-000126-Qt for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:32:04 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uRXrn-0006tu-QB for qemu-devel@nongnu.org; Tue, 17 Jun 2025 11:04:53 -0400 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55HEXDrZ013182; Tue, 17 Jun 2025 15:04:37 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4790yd5h68-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:36 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 55HDhs4T000934; Tue, 17 Jun 2025 15:04:34 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 478yh9bxvm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jun 2025 15:04:34 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 55HF4Svn014869; Tue, 17 Jun 2025 15:04:33 GMT Received: from alaljimee5bm-ol9-20250405.osdevelopmeniad.oraclevcn.com (alaljimee5bm-ol9-20250405.allregionaliads.osdevelopmeniad.oraclevcn.com [100.100.254.235]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 478yh9bxny-9; Tue, 17 Jun 2025 15:04:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=LjaYa fom8TafeELPzF4Q5fuqiXlfP0RnnBbZinxkogk=; b=rEdhCyi0eVq7vth45QDdY qRUcUfWT85Dl0MbB6olIaoEa36E1m7WmVtgZJvJ20+z7456n5ktmzNXKySFTOsY8 n40rVpC0sxqhyyQ4baORJWvjEwUzBeijiMxwT4veubXPGd/cq5rMP4I+oaMtWf0k PKAJhoAWEsU/JVsppWXktL7bkFq4Rm5cD2eBePHsWatiT3iy++/BTNtP6LSuNapJ OZOFn9nfsVsdsY3MfroOeBncpmcX4AnNCR4rmRIkDHD/OU7WcnQ4Ubu15n0r9WVt 79xuVmc4bbA0anb30PYQLJ+rms9PjCuqEAYP61Hsl80wZijXuZX15Zc3bx5GP3gH g== From: Alejandro Jimenez To: qemu-devel@nongnu.org Cc: ethan.milon@eviden.com, mst@redhat.com, pbonzini@redhat.com, mjt@tls.msk.ru, marcel.apfelbaum@gmail.com, richard.henderson@linaro.org, eduardo@habkost.net, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, santosh.shukla@amd.com, sarunkod@amd.com, brijesh.singh@amd.com, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, alejandro.j.jimenez@oracle.com, philmd@linaro.org Subject: [PATCH v4 8/8] amd_iommu: Fix truncation of oldval in amdvi_writeq Date: Tue, 17 Jun 2025 15:04:27 +0000 Message-ID: <20250617150427.20585-9-alejandro.j.jimenez@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> References: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-17_06,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=862 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2506170117 X-Proofpoint-GUID: aOWDbcyZBpw03LpbfkNrIP4_hH1u6Jq9 X-Proofpoint-ORIG-GUID: aOWDbcyZBpw03LpbfkNrIP4_hH1u6Jq9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjE3MDExOCBTYWx0ZWRfX1lWhqGA6VkSR 3ubpQ6Q7NAecAtHEn27VsYsS4nNJgwzN+SW6S1B4P65EFYuCgPt1puTKDhjRarhfdm3j25sQPJy a6ml2Vf+fHLvtqK7zfitwaDMR4zbqWNLcvXYUkoWljUKoooiftNIdWWKYtmeMspnj8DhdaNbN11 HjUg46jwv+b+cDN3sQmwBX1CQ/qbirNI5CGT6J/K7+l/td7WEVAUFnHYOcuSWRh4Kj7jXZ0leXe LMAU1+qk2Wti80Y4W/SbnuIFhIpGpJ7HsTVSIfnWo0llkMbEVWEktTA9KVIC309f8I/fdjILI4o JXmp4jrT2oSet+yKQJHHSWBU1d5k/F1LR38Jqn4QW1ZwgW9LicdxfigK8Z4ZljV4eKsW+qlXNkO 8jA+8mheaoWsgsVDnH1GTKQqYzMPBWNhJaLR4HaBnlDJ3vTsO3ySMGKzt91sblJBzzSruBok X-Authority-Analysis: v=2.4 cv=XZGJzJ55 c=1 sm=1 tr=0 ts=68518405 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6IFa9wvqVegA:10 a=3GnX9RwCAAAA:8 a=69wJf7TsAAAA:8 a=KmqcU8Jcp4AhgOK5lSYA:9 a=RF-RJRjNljZ93lortB_0:22 a=Fg1AiH1G6rFz08G2ETeA:22 cc=ntf awl=host:13206 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=205.220.165.32; envelope-from=alejandro.j.jimenez@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @oracle.com) X-ZM-MESSAGEID: 1750174395591116600 Content-Type: text/plain; charset="utf-8" From: Ethan Milon The variable `oldval` was incorrectly declared as a 32-bit `uint32_t`. This could lead to truncation and incorrect behavior where the upper read-only 32 bits are significant. Fix the type of `oldval` to match the return type of `ldq_le_p()`. Cc: qemu-stable@nongnu.org Fixes: d29a09ca6842 ("hw/i386: Introduce AMD IOMMU") Signed-off-by: Ethan Milon --- hw/i386/amd_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 92f94dc788c3d..5a24c17548d45 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -140,7 +140,7 @@ static void amdvi_writeq(AMDVIState *s, hwaddr addr, ui= nt64_t val) { uint64_t romask =3D ldq_le_p(&s->romask[addr]); uint64_t w1cmask =3D ldq_le_p(&s->w1cmask[addr]); - uint32_t oldval =3D ldq_le_p(&s->mmior[addr]); + uint64_t oldval =3D ldq_le_p(&s->mmior[addr]); stq_le_p(&s->mmior[addr], ((oldval & romask) | (val & ~romask)) & ~(val & w1cmask)); } --=20 2.43.5