From nobody Tue Nov 26 12:29:55 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1707909658; cv=none; d=zohomail.com; s=zohoarc; b=WzY4isRUbch5tVkSHmSfFK3u6jbUyResEaKQRMgyYHvLhISNsJhG7oF+DdKjvGMwm2SqWF4nuMq69jlfbDroVtlPvgN5agXamvspgNAWjT5GEq+3bssiEkbDrFC4RLFaRfqQ/6znj73yHJ2MfGG2Q4cDMmdL8RAKqPi9MZZV62g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707909658; h=Content-Type: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=ZoIzxN4wtVZC8VE/mIbpxC6DW0nDJt+pWpq7gnJFkLU=; b=UerPa6HP+y9jj+sLAp+v63/rRyOsFoCg+sysUzHdnbay+F9Jcbd3kBcuGSBlX3OMftHXkW/Twp5ZAOTgd3Is1jlpW80y/DvwRVf2reE+f8OztrBVl/wS68CZHpQaQfJZRUESQbofBSpnkpXWR2mMV6CH56ZT9oiA+xfFRIp6e7E= 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 1707909658082354.77990776474905; Wed, 14 Feb 2024 03:20:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raDFD-0005FZ-9n; Wed, 14 Feb 2024 06:16:03 -0500 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 1raDET-000425-Go for qemu-devel@nongnu.org; Wed, 14 Feb 2024 06:15:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raDEP-0007CU-Us for qemu-devel@nongnu.org; Wed, 14 Feb 2024 06:15:15 -0500 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-185-FgGQase3MjqXVq8ItnoeJQ-1; Wed, 14 Feb 2024 06:15:11 -0500 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5611e1da4c6so3589060a12.1 for ; Wed, 14 Feb 2024 03:15:11 -0800 (PST) Received: from redhat.com ([2.52.26.67]) by smtp.gmail.com with ESMTPSA id ca13-20020aa7cd6d000000b005638af177aesm171512edb.53.2024.02.14.03.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:15:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707909313; 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=ZoIzxN4wtVZC8VE/mIbpxC6DW0nDJt+pWpq7gnJFkLU=; b=X1K6p7wDT1w7oG7t3AJIBd2eA6UQWeD3y1lgkIOESSVxlZY+IZ8Ju4B/KQznhyQm0+qIOi Zp1BvEJGpZA85ivMkFt/d4DZ5gK9IUzwsx4bPcEUK8GRAhkUV0RojIB+EvCTr//dLcPrtW JcAU7j3HmrlPfaSG2rrtdF8g6fDMv+I= X-MC-Unique: FgGQase3MjqXVq8ItnoeJQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707909310; x=1708514110; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZoIzxN4wtVZC8VE/mIbpxC6DW0nDJt+pWpq7gnJFkLU=; b=OfAa4fvbo8uM7Lv5DbmtAV51J+wIBxwhIT0DmdaPyyaUoTeYQTahIPCroN/iwpVvIA wH9W2GECnO16gGVI7jUsvZwPIt2+wPUGwxDtQGf7SWYuZ9LuRK634km1d4x/9956Hb04 CvHP8jpMq7FghWubGSeehbTHofEUq315iX+YE5rEcjEHGKdiEho7nliqdfbXPCjV9DHD xJrnGnGAcUF0q1+cnm4pdd92oX1ASZibkuPyKeInJLTDd5CJ/oARZwEL4te+2E7aHntL WHR1R7X7UR2Z3xnGI2UrG2YNRhvRIy7bGjlTPNXZuSyT7meHca/IjoMfTPkFWpMMkj6E 41dQ== X-Gm-Message-State: AOJu0Yzkfmbm4CEoBVEQRWp48cmk1hKqDrQbfvfZlkvG9hTXbFgs9Kzi ehHOSj7oOlpa/OYnqIU1LThAADKgHJpOXrct1s5CLyi4IrNKeyPQQYlNGJQNhWclAGLgE3p2+1t EU4Ve1AWuerzrwORuOG4J3DAgFU4dLsGEgpCN2SoMV+sRgjef0BM481GRipQ1MFQ2EbJ8EG/qOk ko4+WSIkGRCDuj9Qk04VZMynxNqqjlGQ== X-Received: by 2002:aa7:da0a:0:b0:55f:fba9:de8c with SMTP id r10-20020aa7da0a000000b0055ffba9de8cmr1705434eds.21.1707909310099; Wed, 14 Feb 2024 03:15:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJK7n/YA0Gl2lZvV7a0zOZa7QGHzAXexi2mUK7V7/n5DJxtbKMvfS9GTZKGWE8QX9Bj8DZjA== X-Received: by 2002:aa7:da0a:0:b0:55f:fba9:de8c with SMTP id r10-20020aa7da0a000000b0055ffba9de8cmr1705417eds.21.1707909309829; Wed, 14 Feb 2024 03:15:09 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU1Fc1dZC9nuJ3DOptBHrZF/BOPp2m65fqkjj9dDxnAFgLD49vdYbYqBeQ7NPghzf/G62ZSSJPw7Ux+a4RNb7PUGWDgXmjyPCKb7fiF8Mjx6cy+ecqr5bwoxmHu0KFPr8JSzWBKJlz9bMGHhUWXjJeCSEC3xg== Date: Wed, 14 Feb 2024 06:15:07 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , Eric Auger , qemu-arm@nongnu.org Subject: [PULL 36/60] smmu: Clear SMMUPciBus pointer cache when system reset Message-ID: <8a6b3f4dc95a064e88adaca86374108da0ecb38d.1707909001.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.504, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1707909658402100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhenzhong Duan s->smmu_pcibus_by_bus_num is a SMMUPciBus pointer cache indexed by bus number, bus number may not always be a fixed value, i.e., guest reboot to different kernel which set bus number with different algorithm. This could lead to smmu_iommu_mr() providing the wrong iommu MR. Suggested-by: Eric Auger Signed-off-by: Zhenzhong Duan Message-Id: <20240125073706.339369-3-zhenzhong.duan@intel.com> Reviewed-by: Eric Auger Tested-by: Eric Auger Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/arm/smmu-common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index 9a8ac45431..f58261bb81 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -675,6 +675,8 @@ static void smmu_base_reset_hold(Object *obj) { SMMUState *s =3D ARM_SMMU(obj); =20 + memset(s->smmu_pcibus_by_bus_num, 0, sizeof(s->smmu_pcibus_by_bus_num)= ); + g_hash_table_remove_all(s->configs); g_hash_table_remove_all(s->iotlb); } --=20 MST