From nobody Sat May 4 07:48:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1573378011; cv=none; d=zoho.com; s=zohoarc; b=gmozp5R2py+wnkxYTg7vjhIOt8JortMNgheHR30gtBOo2X8hlqJSXvPMdAaeLYoYawrJl99IYdOk81bciMCUQ/D8jnJgCpSk4dgSMhQM8mcLMT2honViODWJIlKZ4VGEauRrZxAlWwYsCXOHC8BciB7BBIPgnx6tv253FPtssPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573378011; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wmWx6HkZ9Zfb/OVeyGttArc+S62/oMNpe0KFRh2V8HE=; b=YSrC1n04ddzcrEO3JtJwJ2RFxvlC9m6zG0pw+HRgIJ9fe5Gbim36ptvhdXM6b+nBs+esRr7oBCsnhWK175A2XoYHmF5kXSTpAi2gZd2zbikoU1B5bwLCJnkSvgVp3pdQVjCqnky/ooaGtq9Z9mUCYaWXS6e5v0VG9TrCQlnxrys= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1573378011713442.1478514490584; Sun, 10 Nov 2019 01:26:51 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iTjTP-0004Sb-4i; Sun, 10 Nov 2019 09:25:31 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iTjTN-0004SR-Kf for xen-devel@lists.xenproject.org; Sun, 10 Nov 2019 09:25:29 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 079cb9a8-039c-11ea-a1f4-12813bfff9fa; Sun, 10 Nov 2019 09:25:27 +0000 (UTC) X-Inumbo-ID: 079cb9a8-039c-11ea-a1f4-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1573377928; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/tEVaFfCmin8bNmFhv84WNA3WrmA1Zy61SW+C74zaWU=; b=IPD6tmEaOa0kmWutGwbxLgj49QV5etlxpy4CvI9cpmEIAmAjMRQqoiDV ZjIRHm2xS1sAUj3w0SLwIjmQAXFUP1T2EcFyFff0lzUy4bHFybUOnI2C9 PqClI5khYl4ovW4VtgxPpsEZ8It0vnwOe/shWDdbvf6lX+DuH9yBKrmkd 0=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: RR4lqlDHIoRaHy7/dkrKAGNQiQ8I0MDfzsovze1ILAaLiFI9/R9i0VKrCb6O/VIJV+tkTnFF2N peeXFU4hy/TLzdEMUyXrNgpFuBXYqZ8Sz7qYw2DE5HEeTQ+vgmFbWrd+2uWsewdSmtOswTuKku VovupM7hY4um/dFQwnsQtSb4kd6MxqHXiA8pBQjTyzLvWrQ24umcbtBjp3Gy9o3zmDAMwfLRnq Umi/RVZLitdGz7k35g9x5fAE7q+lddLJDaLanpEY5/nG3U3XvqEccz2YlC15cdU460fXHT0hC+ FH0= X-SBRS: 2.7 X-MesageID: 8217509 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.68,288,1569297600"; d="scan'208";a="8217509" From: Roger Pau Monne To: Date: Sun, 10 Nov 2019 10:25:05 +0100 Message-ID: <20191110092506.98925-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191110092506.98925-1-roger.pau@citrix.com> References: <20191110092506.98925-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-4.13 v2 1/2] x86/ioapic: remove usage of TRUE and FALSE in clear_IO_APIC_pin X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Andrew Cooper , Wei Liu , Jan Beulich , Roger Pau Monne Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) And instead use proper booleans. No functional change intended. Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- Cc: Juergen Gross --- xen/arch/x86/io_apic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 37eabc16c9..b9c66acdb3 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -502,7 +502,7 @@ static void clear_IO_APIC_pin(unsigned int apic, unsign= ed int pin) struct IO_APIC_route_entry entry; =20 /* Check delivery_mode to be sure we're not clearing an SMI pin */ - entry =3D __ioapic_read_entry(apic, pin, FALSE); + entry =3D __ioapic_read_entry(apic, pin, false); if (entry.delivery_mode =3D=3D dest_SMI) return; =20 @@ -512,15 +512,15 @@ static void clear_IO_APIC_pin(unsigned int apic, unsi= gned int pin) */ if (!entry.mask) { entry.mask =3D 1; - __ioapic_write_entry(apic, pin, FALSE, entry); + __ioapic_write_entry(apic, pin, false, entry); } - entry =3D __ioapic_read_entry(apic, pin, TRUE); + entry =3D __ioapic_read_entry(apic, pin, true); =20 if (entry.irr) { /* Make sure the trigger mode is set to level. */ if (!entry.trigger) { entry.trigger =3D 1; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); } __io_apic_eoi(apic, entry.vector, pin); } @@ -530,9 +530,9 @@ static void clear_IO_APIC_pin(unsigned int apic, unsign= ed int pin) */ memset(&entry, 0, sizeof(entry)); entry.mask =3D 1; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); =20 - entry =3D __ioapic_read_entry(apic, pin, TRUE); + entry =3D __ioapic_read_entry(apic, pin, true); if (entry.irr) printk(KERN_ERR "IO-APIC%02x-%u: Unable to reset IRR\n", IO_APIC_ID(apic), pin); --=20 2.23.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sat May 4 07:48:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1573378010; cv=none; d=zoho.com; s=zohoarc; b=W/RBefEW4YZn/4YNdtLSSlNhb+d0halvq5rawvKpYWZW6nxQt686y6G3OsSNqFeWO7XX8pQfQhA2MfxTskbNWu21JNdW27TuFAge8myiNO52hxmkMctsJW/7+0z/2pTbJNzF12bCqfazF76ocfH9U63+v6axJ/51pGrr0JAGijw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573378010; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IYCKWZgEj4kOMswRXZq5hqywjs1ZEjJ9lRBSeRg6WUQ=; b=APwZZe1M/Py04bfhuZkAywOBmrDOIcSO2AKGASZd2xI5/ZsjN4dQR3yorhS9UUITiWDpD6tV8m9kF+HqEVq5A/7oI3mKOUITg5K08XQ9Eb7YhQN+oPfkqq3W4tO9R2XeW9JxPtfGbuCUgCRhGhJwcfjxQahfNQzKRbcR+8c83Ak= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1573378010114197.03480281451618; Sun, 10 Nov 2019 01:26:50 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iTjTQ-0004Sn-E2; Sun, 10 Nov 2019 09:25:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iTjTO-0004SW-Rn for xen-devel@lists.xenproject.org; Sun, 10 Nov 2019 09:25:30 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0890c7dc-039c-11ea-b678-bc764e2007e4; Sun, 10 Nov 2019 09:25:28 +0000 (UTC) X-Inumbo-ID: 0890c7dc-039c-11ea-b678-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1573377928; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Vy946q6ELv6+e6EM5/tRPQSTbaba2GB+GQ1rRw6WjYI=; b=R80TPtydFIYyEQB9xkhIg4ipoD2Zn/ZXU/M5z91f3TnvRY9+yM2f05YZ bQTvaN26YOU8TQ9JvvjfOUcF7iLItRp+6dnkPdKzfoW08g+OTF9DnvOET SLv0kaY1lpzcwtCCqupI6dWm7nAAK0nkSHoyeXjvSUAG2eb8sSxyRKh39 I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: E4XLLWzsG9OhkU5fCOohe78rDoOHxnWRLLhz/Q7Lo1+GbLF6QcmSyWLifVXvJ19qaH5lHUeH81 xbzuSKaTQxPpiVcICgvlf+3s/gfV6Lks4ZGNgWoJ9J0cIpL6wgumII4qJkgRfRQP+/g4w24T2S OKxdsCH+oTZOhqN2w98Ssvu6R7s5beZKQ86Rr+a5BkB8T2Ti6UBXfceRO43xEHY/F0HiCU/KG9 vd5I/KqT0ckf1XcKHVr/dI9JuHN+QaK+ukEyWC1gM0pEll+v/7B0OvRNipQNoizd84azdGy9CJ du0= X-SBRS: 2.7 X-MesageID: 8515884 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.68,288,1569297600"; d="scan'208";a="8515884" From: Roger Pau Monne To: Date: Sun, 10 Nov 2019 10:25:06 +0100 Message-ID: <20191110092506.98925-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191110092506.98925-1-roger.pau@citrix.com> References: <20191110092506.98925-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-4.13 v2 2/2] x86/ioapic: fix clear_IO_APIC_pin write of raw entries X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Sergey Dyasli , Wei Liu , Andrew Cooper , Jan Beulich , Roger Pau Monne Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) clear_IO_APIC_pin can be called after the iommu has been enabled, and using raw reads and writes to modify IO-APIC entries that have been setup to use interrupt remapping can lead to issues as some of the fields have different meaning when the IO-APIC entry is setup to point to an interrupt remapping table entry. The following ASSERT in AMD IOMMU code triggers afterwards as a result of the raw changes to IO-APIC entries performed by clear_IO_APIC_pin. (XEN) [ 10.082154] ENABLING IO-APIC IRQs (XEN) [ 10.087789] -> Using new ACK method (XEN) [ 10.093738] Assertion 'get_rte_index(rte) =3D=3D offset' failed at= iommu_intr.c:328 Fix this by making sure that modifications to entries are performed in non raw mode. Reported-by: Sergey Dyasli Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- Cc: Juergen Gross --- Changes since v1: - Do not change all instances of raw reads. - Fix commit message --- xen/arch/x86/io_apic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index b9c66acdb3..732b57995c 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -519,8 +519,9 @@ static void clear_IO_APIC_pin(unsigned int apic, unsign= ed int pin) if (entry.irr) { /* Make sure the trigger mode is set to level. */ if (!entry.trigger) { + entry =3D __ioapic_read_entry(apic, pin, false); entry.trigger =3D 1; - __ioapic_write_entry(apic, pin, true, entry); + __ioapic_write_entry(apic, pin, false, entry); } __io_apic_eoi(apic, entry.vector, pin); } @@ -530,7 +531,7 @@ static void clear_IO_APIC_pin(unsigned int apic, unsign= ed int pin) */ memset(&entry, 0, sizeof(entry)); entry.mask =3D 1; - __ioapic_write_entry(apic, pin, true, entry); + __ioapic_write_entry(apic, pin, false, entry); =20 entry =3D __ioapic_read_entry(apic, pin, true); if (entry.irr) --=20 2.23.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel