From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::82c; helo=mail-qt1-x82c.google.com; envelope-from=poxyrantab@gmail.com; receiver=edk2-devel@lists.01.org Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (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 097362115741A for ; Tue, 25 Sep 2018 06:10:07 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id e9-v6so12812159qtp.7 for ; Tue, 25 Sep 2018 06:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=1gcPXBcoFMM1WtUPqfBEpouPmyOPO/NfkM9gq9xohhI=; b=j1Xn5GfF/wO+ESRCQEovSG91kP0wtW1XaTpBzShAAouK7P6WnRz9ZRmH5ezfgZFAEB zKFRdX2eP6LR5skI6V1QsxpQi9kq66FVZ1P7ar/qZlxEnM+jW0AJAzSLCN7wioz/2RDR neks9D0qjoP7XXK1oDIvdxZ1r5Vvf7E6WJmpzmdG2uaz5k19Ttmo794NWvddCy21cGoJ yOqdlkLhJ9IhrHbaJBBDJQKIaGDDrkawTcFLzKzTx5DZ3uGb/aRvq7WOR4Zd2tAB8Bej g3bqqBT64GkT+Tq9Onx4uzvxjCr2AonEV8ScJMNWR6uyatuOuF+3fW7v7x9wEh8MbexH l8Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=1gcPXBcoFMM1WtUPqfBEpouPmyOPO/NfkM9gq9xohhI=; b=jT32/VXstSqVcOzVjt+w44O5Z/MbwIPF+T/r+FX0lkSEk7IEW+FXuJ5n9yd4djbxU/ HQc1vBDZUoOtkzZ7/zE+14O16pXG8fQaTB/QqaqCyp6qPiKSuhaDqXmjWrno3tpv7Dad mDxKA2p8TRBo9D9VXJY+kMWxaCJvQXDqlYycEqmXqbv7I9zJjZXtRvIWtHUFwAzF4xLv fVxUe5iifb9XDtk74KRaQSixI9vv/qgmiMjT3Bewh4t9yyi5MNTzUxOL/UUvfO1eVDE9 7WZSK1n4fNcl1en1G6ChM1oIs8F5/rPMJLxAANdqA7DBLkwVTONYK6dOk2/lCxinK0YT gkAQ== X-Gm-Message-State: ABuFfojmRPusxP3bTLcDjZFD7RXabbiCCIEQGjBcMXNYvzADYt6Nf8sV 5DpbarOeag8PJ6mRBbRZG9r004onr07T X-Google-Smtp-Source: ACcGV63jmtOuJES+Fl0F9J9OPdRa1z/WTN2rai0qiueHEaxUYcxYGVSdT9o1+W4luFRzOlLPGRsbdw== X-Received: by 2002:a0c:919d:: with SMTP id n29-v6mr708247qvn.142.1537881006265; Tue, 25 Sep 2018 06:10:06 -0700 (PDT) Received: from [192.168.1.12] ([190.210.135.96]) by smtp.gmail.com with ESMTPSA id h9-v6sm1444049qtk.0.2018.09.25.06.10.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Sep 2018 06:10:05 -0700 (PDT) To: Laszlo Ersek , Andrew Fish Cc: edk2-devel@lists.01.org References: <69e85ce8-a6bd-1400-5e16-aadd1551b877@gmail.com> From: poxyran Openpgp: preference=signencrypt Autocrypt: addr=poxyrantab@gmail.com; prefer-encrypt=mutual; keydata= xsFNBFmtwaEBEADEX8sBIXdmdyzW6ywnI6eyftcs6goynrRb3D7a88QOCqhIJY+h6lXcuwc0 JdwR8Lh8xYCchNX0EChSJs3piGdv7HRs8q+PF+wiSCUUfQM0CjIanREXwaRJjm+F8Z2r5+6a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O+Aq+/59JKsnA3ibjcZvmPt8ZJeMfScWsuWG6UrF0hcnCG5I8KA4kgP5Q9yGmAdzPa 0ByOafWKrBgDoIDk/ageU6NVkHcTy+ieh07IWnqEVQO6sQ4+sGOKTdb0dLahiz2gdmbDf90i eu/Zw94n8h8g2bhWjsbKkuz+zg7OSgtGYitWQ0YLMKHQi5vK3u+VcmLqpYoAjUTH+UjBLJvC BzbftVLcZ+12YWe3dwzyI1QI/aCZrHe/AF9NvL8CQAlfzU7pR4IBRkitKeQJODX5/aXQMTMI RuWAylJ5A50IrFYG1qf402OXUmoBa+ekml29cdPFJHe/b+Ydpw2AOgDtPzXabK/OgmbuUseY AkoOyYwn0tYve6ENo4wYHgWnApAaJtBv6FlW/wQq74geUYXQefGdMhZ2ncehuEI7b/dyHecK XH81VLm4LrGnORgUtfDaHusSMLZUN8tsK+FJGTyS5kUUjOFTjyNskytcpVWxh8ea2BgG/sm4 DEmY5RkDHQ1LfT91UTTueFQHhxOact0gTFbjMJH6xPlj85L3jiePpvXo3wP9+r8ZZ0jPSUIM x9zN1xOBrZ7XDr+z0855dl/CEj5tA85CQiIsj8sqbhaq+tXJBtYIhFlK32KayYxLGJfpKiwb 7fNHwZG1plI= Message-ID: Date: Tue, 25 Sep 2018 10:10:04 -0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Subject: Re: [Question] Testing environment regarding SMM driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 13:10:08 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Thanks Laszlo and Andrew for the answers, from what I can see, is not possible to do what I meant but your answers gave me some ideas. Thanks a lot. BR, poxyran On 9/21/2018 4:05 PM, Laszlo Ersek wrote: > On 09/21/18 20:15, poxyran wrote: >> Hello again, >> >> my question is: is it possible to create a SMM driver that >> installs/register a SMI handler (in order to call it from a usermode app >> in the OS) and test it in the UEFI Shell or do I need to setup up a >> dedicated machine with the SMM stack as described in official EDK II >> documentation [1]? >> >> [1] >> >> https://github.com/tianocore/tianocore.github.io/wiki/Testing-SMM-with-QEMU,-KVM-and-libvirt > These questions are not "either/or", they are orthogonal. > > Normally, any pre-existent platform firmware will keep you, as a 3rd > party UEFI developer, *out* of SMM. Doing otherwise would be a huge > security hole. However, if you own the platform in question (meaning you > can build and install the firmware to the platform), then you should be > able to use whatever the SMM infrastructure has to offer. It does not > matter whether you do this on a physical UEFI development platform, or > in OVMF + QEMU/KVM. As long as you get sufficient access to the platform > itself. I hope this answers Q1. > > Regarding the wiki article. I wrote that article mainly for developers > with a Windows desktop background. That's why I recommend to set up a > separate, headless Linux server. Because, running Linux as the host OS, > you get to run OVMF on QEMU not just with software emulation (TCG) but > with hardware virtualization (KVM). And the latter makes for a world of > difference. If you work at a Windows shop, you can run virtualization > clients (management tools) on your Windows desktop, and with them, > connect to the Linux server for managing / running your firmware. > > If you already work on a Linux laptop, you should be able to run OVMF on > QEMU/KVM using nothing but your laptop. In such cases, the libvirt > client and server components, and QEMU, and the host kernel (KVM), and > OVMF, build up the "virt stack" on a single machine. > > Whether you can do the *exact* things you want to do, within OVMF, I > can't tell. I don't know what you mean to do. A good part of the edk2 > SMM stack is built into OVMF with SMM_REQUIRE, but (due to QEMU/KVM > being a virtual platform), at least *some* artifacts of physical > hardware will be necessarily missing. (Such as SMRR, movable LAPIC base, > etc.) OVMF also does not include/provide a number of standardized SMM > abstractions, such as EFI_PEI_SMM_COMMUNICATION_PPI. (That's by choice, > BTW.) > > I vaguely recall that Ray used OVMF as a testbed for some SMM driver he > was developing at some point. I think Ray was using Q35 because of that > (i.e. SMM), and his use case also included CSM, and that's why he wrote > commit db27e9f3d8f0 ("OvmfPkg/LegacyRegion: Support legacy region > manipulation of Q35", 2016-03-15). But I could be totally imagining things. > > If you run > > git log --reverse --grep=SMM -- OvmfPkg > > you'll get a good amount of documentation about OVMF's SMM support. The > first large series was 8786ba4fe722..5e04f4b7e1a4, but things didn't > stop with that, of course. The OvmfPkg/README file has some notes on SMM > too. > > I think you should be able to imitate the variable driver split, for > your use case. You can write a runtime DXE driver that exposes a custom > protocol. You can write a UEFI app (to be started from the UEFI shell) > that locates and calls this protocol. In the implementation of the new > runtime protocol, you can use EFI_SMM_COMMUNICATION_PROTOCOL to send > message buffers into SMM. (Actually you could do this directly in your > UEFI app too.) I expect you should be able to write a DXE_SMM_DRIVER > driver too that registered a hook for the message sent. I don't recall > all the details off-hand, but it's very well specified in the Platform > Init spec. I hope this helps with Q2. > > Thanks > Laszlo