Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp335798pxb; Mon, 16 Aug 2021 06:35:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAedRgLnGbPH8yqV+8XPoTEa+tL/Q3N343EIv4phpi6T5AHqQddLIvxbZOtHmkG0p2pYui X-Received: by 2002:a5d:9906:: with SMTP id x6mr12901834iol.23.1629120920804; Mon, 16 Aug 2021 06:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629120920; cv=none; d=google.com; s=arc-20160816; b=TOCOku7sWa2WOPHHDYp8ENOJ6XpM4jD8MJfiepPdDlA4bx/1IN6WuXW0HWMT/4UH1z STOHi7C56g5TgU4afx5IFhZQHAVUvgCtFK0UmzMdsUDUjtKmwuthp7ylAEaV+4McqDUn tz2TQoo47gm2yh2YDQ/+n4tkCYcsmbqUa7toINe2N+QUP9yh+9iNjIOiWj/m86s7Ou8Q Vq4+2+Kfn0OkPoAquUnHuH8OQrpRAWiVfkUzSDd7sod7MWzrArBBUv431qfM+Y1W0OJP aOGDVzyDttqsuspUSFajE2uckM7gSYnzv8UNhrXNukB0QcRNz6zuSixg8P4LbaDYYz5D ciFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RmoMABQoLZFS64qWlQfFfvu0NqwEZmEkO/qBUZssD6M=; b=ZNC/pkuOoIb4HQSDmOhfKsXv/RS68u5VmFwNK3kqPS9NvyUlLNZ2K6lmn3u9ZZShoj 6jtcaPemlQax98nD+Ju9+5awGmUhZkIEpgQloCkZmphjbQ2/mwQqyUemN5LnY9t+7nto /fhPVnIpQHd5WDqoIJjScJ+qnrhGYF4Q5/wRW2avD7ZB0eh6Z4ioXplpKh7QqCHO8N4Y Pv/CdRobBHoRrb7h1fF5OYz+cKDiGlYRbLUkd5r6YJIsWBk4u6T6ShBv/ismzIsIpEkU gFXpSDbabRQrQd6NR1YKmZiEwbdphOlWhhbrGre6cMBrGk2kku/zBNBGHTiJBsUOBOqi 72nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bF4SaXNz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si11596837ilv.27.2021.08.16.06.35.09; Mon, 16 Aug 2021 06:35:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bF4SaXNz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240415AbhHPNdS (ORCPT + 99 others); Mon, 16 Aug 2021 09:33:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:43336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238936AbhHPNUh (ORCPT ); Mon, 16 Aug 2021 09:20:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3CBBD63292; Mon, 16 Aug 2021 13:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1629119762; bh=0qeMRMTj109+MfWCOVSBV2M0B1pQmue50PE2amcYyYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bF4SaXNzzOHMS0mQ5PVMo5XkjvZypSt2Rb9DopIm6FWQHJrTCF5BkAWMnRqLg/BlK vyCS2eDub6KjU73pSK+kkarHjVKK1yvTJ+w9eerRvieYKHn77AJW4S52U2aEnC+hfu uWI01zUlbTPz0gy4B41Mjy5C9+6pWWrDYa30R0ew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Marc Zyngier , Bjorn Helgaas Subject: [PATCH 5.13 131/151] PCI/MSI: Enforce MSI[X] entry updates to be visible Date: Mon, 16 Aug 2021 15:02:41 +0200 Message-Id: <20210816125448.372561119@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210816125444.082226187@linuxfoundation.org> References: <20210816125444.082226187@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner commit b9255a7cb51754e8d2645b65dd31805e282b4f3e upstream. Nothing enforces the posted writes to be visible when the function returns. Flush them even if the flush might be redundant when the entry is masked already as the unmask will flush as well. This is either setup or a rare affinity change event so the extra flush is not the end of the world. While this is more a theoretical issue especially the logic in the X86 specific msi_set_affinity() function relies on the assumption that the update has reached the hardware when the function returns. Again, as this never has been enforced the Fixes tag refers to a commit in: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git Fixes: f036d4ea5fa7 ("[PATCH] ia32 Message Signalled Interrupt support") Signed-off-by: Thomas Gleixner Tested-by: Marc Zyngier Reviewed-by: Marc Zyngier Acked-by: Bjorn Helgaas Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210729222542.515188147@linutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/pci/msi.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -311,6 +311,9 @@ void __pci_write_msi_msg(struct msi_desc if (unmasked) __pci_msix_desc_mask_irq(entry, 0); + + /* Ensure that the writes are visible in the device */ + readl(base + PCI_MSIX_ENTRY_DATA); } else { int pos = dev->msi_cap; u16 msgctl; @@ -331,6 +334,8 @@ void __pci_write_msi_msg(struct msi_desc pci_write_config_word(dev, pos + PCI_MSI_DATA_32, msg->data); } + /* Ensure that the writes are visible in the device */ + pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl); } skip: