Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5326139imu; Tue, 13 Nov 2018 05:00:12 -0800 (PST) X-Google-Smtp-Source: AJdET5ddMpf6G4wznkgN0e4OS+lfTxxbLoaP0lIAm0NR4E3W2GzY6O0OTb9ZuE4IZYdDTSGY1W+U X-Received: by 2002:a65:63d3:: with SMTP id n19mr4728985pgv.179.1542114012115; Tue, 13 Nov 2018 05:00:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542114012; cv=none; d=google.com; s=arc-20160816; b=kr//tnJdhUkC9ZOAWh1eeaAjVQ5zrTx8YxP2h6LOrcqin6pLybzU8hu3NzO7s5qfUk rEeZTCBdjWV3t12k8GrRSv+WxPObce+pow+Cc6L9J35/DDMhQnR3te4TuB3u7W/ZMw9n poPYPYZtYGtWLE/CUiVhRGVKFsNK5F5wo3vJ5OquSMYF4zvm1rScb+npRIVVeGox6DRR FEyXVpB4XhGNV76efe54qmBPmeyD+M/LuMWeThChDyq8jXB2qAhXDHBZp+aXWyzLiQaO kch8VV7GQcL7DlM/xEr1+ob6e6h/l0lGurHFLGLAN7Qjfy0sghs3h6UHFz+DuPsfL4oP xeyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xCabVL2Q8e2O4vqaeE6+tY+Tg8ogmI2yzMuza1JwzCk=; b=zmb6fwQLfyjcj1ccbm1sMUR/9bIiMXI7YViQgKC5K4tEuiefvKDcjD10Wl/J7iB+i1 9XvF+85MRa1l66qtb9l/yQyH6N2ZKgI8oM67EkrwHNQEApCMb13BULt7PNNdFQzdPfOR /+ldJ4g3GJOwKNqiMUAtespInvUawqCAypqPLeSEDElaN5h7Eo9kppCXUPeJE9DCphgy QDUj3ZfWVlG1DfSJROFRFIKOz0OnsqQsovOHIZixI0o9LLrd3mVR9gvPEIsnq59bhnMF Es296FURTcy2iapQeeMzit8pQWxJvnpOA0Ek1PrBWT31R+zRKmUX4YwhJzQMl8WzpOiQ Srfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si18190422pgc.587.2018.11.13.04.59.56; Tue, 13 Nov 2018 05:00:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733206AbeKMW5R (ORCPT + 99 others); Tue, 13 Nov 2018 17:57:17 -0500 Received: from mga14.intel.com ([192.55.52.115]:50887 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732875AbeKMW5Q (ORCPT ); Tue, 13 Nov 2018 17:57:16 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2018 04:59:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,499,1534834800"; d="scan'208";a="99870839" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by orsmga003.jf.intel.com with SMTP; 13 Nov 2018 04:59:12 -0800 Received: by lahna (sSMTP sendmail emulation); Tue, 13 Nov 2018 14:59:10 +0200 Date: Tue, 13 Nov 2018 14:59:10 +0200 From: "mika.westerberg@linux.intel.com" To: Shameerali Kolothum Thodi Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Wangzhou (B)" , Linuxarm , Lukas Wunner Subject: Re: Qemu Guest kernel 4.20-rc1 PCIe hotplug issue Message-ID: <20181113125910.GB2500@lahna.fi.intel.com> References: <5FC3163CFD30C246ABAA99954A238FA8387DD344@FRAEML521-MBX.china.huawei.com> <20181113122522.GA2500@lahna.fi.intel.com> <5FC3163CFD30C246ABAA99954A238FA8387DF43F@FRAEML521-MBX.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5FC3163CFD30C246ABAA99954A238FA8387DF43F@FRAEML521-MBX.china.huawei.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 13, 2018 at 12:36:20PM +0000, Shameerali Kolothum Thodi wrote: > > @@ -156,9 +156,9 @@ static void pcie_do_write_cmd(struct controller *ctrl, > > u16 cmd, > > slot_ctrl |= (cmd & mask); > > ctrl->cmd_busy = 1; > > smp_mb(); > > + ctrl->slot_ctrl = slot_ctrl; > > Actually I tried this one, but it doesn't help in this case as the initial > pcie_capability_read_word() returns the slot_ctrl without PCI_EXP_SLTCTL_HPIE > bit set. It looks to me pcie_enable_notification() function enables this, > > if (!pciehp_poll_mode) > cmd |= PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE; > > I don't know this is as per the spec or not as the initial cap read doesn't seems to > have the PCI_EXP_SLTCTL_HPIE bit set. If I read the code right cmd value should end up in ctrl->slot_ctrl properly from pcie_enable_notification(). However, I think we are missing check for PCI_EXP_SLTCTL_CCIE in pciehp_isr(). Here's an updated patch, can you try and see if it makes any difference? diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 7dd443aea5a5..da2cbe892444 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -156,9 +156,9 @@ static void pcie_do_write_cmd(struct controller *ctrl, u16 cmd, slot_ctrl |= (cmd & mask); ctrl->cmd_busy = 1; smp_mb(); + ctrl->slot_ctrl = slot_ctrl; pcie_capability_write_word(pdev, PCI_EXP_SLTCTL, slot_ctrl); ctrl->cmd_started = jiffies; - ctrl->slot_ctrl = slot_ctrl; /* * Controllers with the Intel CF118 and similar errata advertise @@ -522,7 +522,7 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id) * in the Slot Control register (PCIe r4.0, sec 6.7.3.4). */ if (pdev->current_state == PCI_D3cold || - (!(ctrl->slot_ctrl & PCI_EXP_SLTCTL_HPIE) && !pciehp_poll_mode)) + (!(ctrl->slot_ctrl & (PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE)) && !pciehp_poll_mode)) return IRQ_NONE; /*