From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c06::229; helo=mail-io0-x229.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E20FD203525F2 for ; Thu, 26 Oct 2017 07:08:29 -0700 (PDT) Received: by mail-io0-x229.google.com with SMTP id 134so5658091ioo.0 for ; Thu, 26 Oct 2017 07:12:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=plZwLu0X1GkIpN02fOqkeKMXZnDmBd9Cj82jOJfm6Gs=; b=R/HRTQ7/tTwlVBJP7Ct69j3lErbcfGdgCnysNb8i0atRIePvSQ1Y2/KduMzVYmP5UH d99AkVfOdxNi2NVCklsP6O7tbyTjqpzicR6N+lcvP74D8GzfxY1iyUpNiS+Izt270hEL anhG43ubIZAWZjcUr1bIaru/+Ho6vptMcC6mw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=plZwLu0X1GkIpN02fOqkeKMXZnDmBd9Cj82jOJfm6Gs=; b=KbaPfFl+w+uN7whKeqmX6va8U+l7iZw++cBzzazojzwHj3EcgchrnYD0aEFMbxjl94 KOf4rZa2DHHR3qWag2Pw+dkKuB4bA2qVBo2/CF0whrVjXMYSAhXHYpFB6XklDu4bPIXI 9vtWXSVz5Y+4dQorCA6dOlIp8JdRsMbXPxlxxWA1JFbkLvBHmU1z6N7Pmc6OIiiUMuRi vLWDZ537cVPsm5RF81SzR1xR8rAXyrzNOr8g6zR+Xdtw9QYFchENJvlfeHn7mfeDfwue mXl808bTLm5AoXpO7fH348bDqg2z6NoO0Yy1gnHJIlo84gPYaa36PLdrpgnyYkoW/fmf RJIQ== X-Gm-Message-State: AMCzsaWNRyi9YG5bnSV3FNbxJGin43JkxQ/krZQ9fBN3++TER5sYWWBH f7FuuIGQwG71qEy7kyXDZNjCArP31HvIyVJ49LktOg== X-Google-Smtp-Source: ABhQp+Q7pczubD7fgDFikCWTscHBseysrb/t4CVjIuVVbLYD3R8qA+AHvTHW9f0CPNtT8ZKaqrPcB39EdaeStCppBr4= X-Received: by 10.107.174.234 with SMTP id n103mr28206062ioo.43.1509027135317; Thu, 26 Oct 2017 07:12:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.131.167 with HTTP; Thu, 26 Oct 2017 07:12:14 -0700 (PDT) In-Reply-To: References: <20170907224116.895-1-lersek@redhat.com> <20170907224116.895-4-lersek@redhat.com> <5bf829cb-4517-a579-ba7c-745c4ee89147@redhat.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B9AE2CE@shsmsx102.ccr.corp.intel.com> From: Ard Biesheuvel Date: Thu, 26 Oct 2017 15:12:14 +0100 Message-ID: To: Laszlo Ersek Cc: "Zeng, Star" , Brijesh Singh , edk2-devel-01 , "Yao, Jiewen" , "Dong, Eric" , Igor Mammedov Subject: Re: [PATCH 03/10] MdeModulePkg/AtaAtapiPassThru: disable the device at ExitBootServices() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 14:08:30 -0000 Content-Type: text/plain; charset="UTF-8" On 26 October 2017 at 15:09, Laszlo Ersek wrote: > Ard, Star, > > (CC Igor) > > On 10/26/17 07:08, Zeng, Star wrote: >> Good point. >> >> Could we find out what change causes the performance regression? Bus Master disable / Memory Space disable / IO Space disable? >> How about to only disable Bus Master in the exit boot service event notification? It seems the key point suggested by UEFI Driver_Writer_Guide_V1.0.1_120308.pdf. >> >> 7.7 >> Examples from the EDK II that use this feature are the PCI device drivers for USB Host >> Controllers. Some USB Host Controllers are PCI Bus Masters that continuously access a >> memory buffer to poll for operation requests. Access to this memory buffer by a USB >> Host Controller may be required to boot an operation system, but this activity must be >> terminated when the OS calls ExitBootServices(). *The typical action in the Exit Boot >> Services Event for these types of drivers is to disable the PCI bus master* and place the >> USB Host Controller into a halted state > > thank you for the ideas. > > * Disabling only EFI_PCI_IO_ATTRIBUTE_BUS_MASTER at EBS mitigates the > symptom. > > * Disabling (EFI_PCI_IO_ATTRIBUTE_BUS_MASTER | EFI_PCI_IO_ATTRIBUTE_IO) > at EBS preserves the symptom. > > * Disabling > (EFI_PCI_IO_ATTRIBUTE_BUS_MASTER | EFI_PCI_IO_ATTRIBUTE_MEMORY) at EBS > also mitigates the symptom. > Excellent! > So it is as Ard suspected, disabling IO port decoding is what tickles > the bug in Windows. > > (Now I'm vaguely recalling an earlier discussion from qemu-devel that > Windows has a bug in that, if any given PCI device is disabled at boot, > then Windows will not load drivers for it, or some such. I'm struggling > to recall the context; maybe it was related to ACPI generation in QEMU. > I'm CC'ing Igor; maybe he remembers better.) > > I will post a patch, for disabling EFI_PCI_IO_ATTRIBUTE_BUS_MASTER only. > First, that's going to follow the driver writers' guide verbatim; > second, disabling BMDMA and MMIO, but not IO, would look weird in the > code. :/ > > Thank you both for the help! Anytime.