Received: from canpmsgout07.his.huawei.com (canpmsgout07.his.huawei.com [113.46.200.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 851863CE4B6; Tue, 23 Jun 2026 08:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.222 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782204666; cv=none; b=qz/z0gJGgIue4uwxCsyvyYDLP4vtEKRwsRxc7FIfl/Ai0Kgb2/KLnP5m9qL+iFnn8LHaqD2UVVPz2zk8YsKUv9CPFQurSzmJVJ3TUisuQ09XUJ1hiDPqGDNIbjnVBDUUHCyMUwmYvrHxDrqVu710BBWLiqoAOkJ03PCW/k6rNGU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782204666; c=relaxed/simple; bh=TceWdLqyoEqF0wgYcW76QVPb0c89JXP7Z7+CoTmNChE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Fntrf6Wl3ia/zPYrUrEWWU8QI71w3bvLl056W6Lxdp/I1tO8OhkfXcf7nUedPFx/rDySCLJg7NnCDWWa9p+7lsI+x+GEscS8H/tYo1RX7wuDSMArFHAzeNJMXK9Hlte5x3O48c6pM5QeR4u7VO9cyk/UOdTCS1QNxiPbg29mI6g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=xRQYW2iV; arc=none smtp.client-ip=113.46.200.222 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="xRQYW2iV" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=yOrZh8oiAh72SZyQXuFXsSrrf0CdqeM5HWo0F9j1+uI=; b=xRQYW2iVPEw2t5QKKqLGeb4BO2PG/BA/28/EFsAWVU2tagssd+ZgCIVDRU9taXN+HMm/sws7B +dgqOeQo81ov9ktGVG/Wvb0Q2+iFJhYpwWSjA3ROdh5zqAniczGQVDrhJ7TfBSthu+IW5v6Ei62 1PH4Nlg3SVN8R5UgCr7CYU0= Received: from mail.maildlp.com (unknown [172.19.162.92]) by canpmsgout07.his.huawei.com (SkyGuard) with ESMTPS id 4gkz7z4B1tzLlXJ; Tue, 23 Jun 2026 16:41:51 +0800 (CST) Received: from kwepemo500009.china.huawei.com (unknown [7.202.194.199]) by mail.maildlp.com (Postfix) with ESMTPS id 4550E40562; Tue, 23 Jun 2026 16:50:56 +0800 (CST) Received: from localhost.localdomain (10.50.163.32) by kwepemo500009.china.huawei.com (7.202.194.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Tue, 23 Jun 2026 16:50:55 +0800 From: Chengwen Feng To: , , CC: , , , , , , , Subject: [PATCH RESEND v18 02/12] PCI/TPH: Fix tph_enabled concurrent update race by bitfield packing Date: Tue, 23 Jun 2026 16:50:38 +0800 Message-ID: <20260623085048.51139-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260623085048.51139-1-fengchengwen@huawei.com> References: <20260623085048.51139-1-fengchengwen@huawei.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemo500009.china.huawei.com (7.202.194.199) Split tph_enabled from shared pci_dev bitfield into spare bit of tph_cap's u16: tph_cap is immutable post-enumeration (15 bits for offset), remaining 1 bit stores tph_enabled. Removes cross-bitfield concurrent write hazards highlighted by Sashiko after VFIO TPH exposure. No functional changes. Signed-off-by: Chengwen Feng --- include/linux/pci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/pci.h b/include/linux/pci.h index ebb5b9d76360..fac439ce53b0 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -472,7 +472,6 @@ struct pci_dev { unsigned int ats_enabled:1; /* Address Translation Svc */ unsigned int pasid_enabled:1; /* Process Address Space ID */ unsigned int pri_enabled:1; /* Page Request Interface */ - unsigned int tph_enabled:1; /* TLP Processing Hints */ unsigned int fm_enabled:1; /* Flit Mode (segment captured) */ unsigned int is_managed:1; /* Managed via devres */ unsigned int is_msi_managed:1; /* MSI release via devres installed */ @@ -588,7 +587,8 @@ struct pci_dev { u8 reset_methods[PCI_NUM_RESET_METHODS]; /* In priority order */ #ifdef CONFIG_PCIE_TPH - u16 tph_cap; /* TPH capability offset */ + u16 tph_cap:15; /* TPH capability offset */ + u16 tph_enabled:1; /* Whether TPH is enabled */ u8 tph_mode; /* TPH mode */ u8 tph_req_type; /* TPH requester type */ #endif -- 2.17.1