From patchwork Thu Dec 17 13:22:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Youquan Song X-Patchwork-Id: 68517 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBI4ixt2005715 for ; Fri, 18 Dec 2009 04:47:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752845AbZLQFra (ORCPT ); Thu, 17 Dec 2009 00:47:30 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752799AbZLQFra (ORCPT ); Thu, 17 Dec 2009 00:47:30 -0500 Received: from mga12.intel.com ([143.182.124.36]:19997 "EHLO azsmga102.ch.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752550AbZLQFr2 (ORCPT ); Thu, 17 Dec 2009 00:47:28 -0500 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 16 Dec 2009 21:47:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,316,1257148800"; d="scan'208";a="223878849" Received: from youquan-linux.bj.intel.com (HELO localhost) ([172.16.182.102]) by azsmga001.ch.intel.com with ESMTP; 16 Dec 2009 21:47:22 -0800 Date: Thu, 17 Dec 2009 08:22:48 -0500 From: "Youquan,Song" To: jbarnes@virtuousgeek.org Cc: andrew.patterson@hp.com, andi@firstfloor.org, ying.huang@intel.com, kent.liu@intel.com, youquan.song@intel.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [Resend PATCH]PCIe AER: reject aer inject if hardware mask error reporting Message-ID: <20091217132248.GC11466@youquan-linux.bj.intel.com> References: <20091211234855.GB7196@youquan-linux.bj.intel.com> <1260836954.19155.84.camel@bluto.andrew> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <1260836954.19155.84.camel@bluto.andrew> User-Agent: Mutt/1.5.9i Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c index 7fcd533..d002cd9 100644 --- a/drivers/pci/pcie/aer/aer_inject.c +++ b/drivers/pci/pcie/aer/aer_inject.c @@ -321,7 +321,7 @@ static int aer_inject(struct aer_error_inj *einj) unsigned long flags; unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn); int pos_cap_err, rp_pos_cap_err; - u32 sever; + u32 sever, mask; int ret = 0; dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn); @@ -374,6 +374,24 @@ static int aer_inject(struct aer_error_inj *einj) err->header_log2 = einj->header_log2; err->header_log3 = einj->header_log3; + pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &mask); + if (einj->cor_status && !(einj->cor_status & ~mask)) { + ret = -EINVAL; + printk(KERN_WARNING "The correctable error(s) is masked " + "by device\n"); + spin_unlock_irqrestore(&inject_lock, flags); + goto out_put; + } + + pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK, &mask); + if (einj->uncor_status && !(einj->uncor_status & ~mask)) { + ret = -EINVAL; + printk(KERN_WARNING "The uncorrectable error(s) is masked " + "by device\n"); + spin_unlock_irqrestore(&inject_lock, flags); + goto out_put; + } + rperr = __find_aer_error_by_dev(rpdev); if (!rperr) { rperr = rperr_alloc;