From patchwork Mon Jun 4 14:50:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 137635 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1611282lji; Mon, 4 Jun 2018 07:50:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJYzPU5cHHXtxwAd6if/IzS11VV3rXUkuFBsH5Kr1CflMSwdkqXx7WvX75llPGrnqAZE2Gk X-Received: by 2002:a65:5b0a:: with SMTP id y10-v6mr9473982pgq.112.1528123837147; Mon, 04 Jun 2018 07:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528123837; cv=none; d=google.com; s=arc-20160816; b=APzfyAJsY6EpAPnc/z7hsERL3VOe1bhtzK76/wlakqyGiDSo6XyCwEk+hwFLNCV40D 11KBT/hLjCAjoon5markL+5lQvH2fHrTiG4jtgL5AT5bRAXeydINobmIzXrjjlmVP01a F24mwv6WUOIk9g2yeMEO4l5PlEj1OiecsWFNHiCdqzK0rg6Qv953bNeE73iZqrG3yQTX nklBm7KRtiWM3UtNeb3Dv8i3gZaFAaVvZb7PFMnDprlzBBHOjR+VctSDU+wQaPtXiKIs 2pKSr8ftwKrF5Yz5egoegHCe8Jh59cW8jVjck+AmBCBKh62gF50EBhH3XC8J1xemKafu lr1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=oUyW6wI/lIapAfyTvQ96raQr0dF8Kft6zgsF+S7TrC4=; b=IwScwyc+/jcWuY7N75mVbrUxBNUEfuc8csPmizhpgcxFjsyKJemfNo1XSh1aP8v/Rp m7y1XmcKby83khrrD+jz5Hbh70NQAEPHJYh3WkL8dvCXPR8sGvGEXBD2Z+KdK2WqbYVp X9HYe3bBikpj9OAZLv5/ti/XMey6nHU0yRf/V3CaH2D/FmLzz3zA3KQsQ9gxDt6bsOQQ AeWiEAP5dL5pvyszOwvQIeWSjBGOhxwGtMQVwPL04dL1I1jR43bhVrzTpgJMym0z2QHU 6YB2RMzl4n+AbU6dF8gsZaHMqaILuKGmhm4fOD2ztGJEuPXXJvldaVQ10J1un1kJdiOR rmBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=G38uHerb; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id r11-v6si24724216pfd.193.2018.06.04.07.50.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 07:50:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=G38uHerb; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AA9CC20974116; Mon, 4 Jun 2018 07:50:36 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (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 1FE8D207DF29D for ; Mon, 4 Jun 2018 07:50:34 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id h10-v6so2983615wrq.8 for ; Mon, 04 Jun 2018 07:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=yCMV3TwB4zsQl6vJH1qqoymelEHBqzfPSexWmERYuRw=; b=G38uHerbZPWM79VQ+p/pBrFtxdOeTtxsJ6anqW3nfE6vxKxIlBiu8lHoFAxjzj0lqZ rKwiD2SZJ+mrkBgvOrthobEqXDYRWcM1NHYjDXohrgR7poSDIO95ZlTBshrd9jHr9+Ul Ya0rW4/l0ksrbZjDrUsmNGgpLAcL0rPxYNMSw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yCMV3TwB4zsQl6vJH1qqoymelEHBqzfPSexWmERYuRw=; b=NCurYdvIhQ1phSLataM88sTWrJMZgzDKeegsSbZgToSE9f2LOJ3ggx/MDusrBYIRKM JXJGaY81fMvaqTPdwPoayjlSz0xi/HT70yeawqCh7Ij9hH5NGTEdaXtaM45NL43HzURr yHZIOzwWnveN/kK4KVMqEy4h1TJlQZrgTQuxpPUmipgHMraDeE7yNXSdryFEF09x1YxT 4iCs6tz6hINnRCrl90YlrUlrb0pM8qBu2Uz9GKF2PpQiakX7HxJdPw2COzI64FS0utVy dUwrRR8o2EAUjfpDg81whxdXflRhiwhueHw/78pbmAKcGSeCEsHgvjdzbjBJqAcvdGmG wvhg== X-Gm-Message-State: ALKqPwfTlIfzUJJz64khGm625VSwfzYbHFIbrToZxE2sjjB2YfM7ruiE nubDB+WYw/xpmFa09afkcI6pIYqRneA= X-Received: by 2002:a5d:470b:: with SMTP id y11-v6mr10075762wrq.107.1528123832083; Mon, 04 Jun 2018 07:50:32 -0700 (PDT) Received: from dogfood.home (LFbn-NIC-1-75-91.w2-15.abo.wanadoo.fr. [2.15.165.91]) by smtp.gmail.com with ESMTPSA id e2-v6sm1438744wro.97.2018.06.04.07.50.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 07:50:31 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 4 Jun 2018 16:50:28 +0200 Message-Id: <20180604145028.437-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 Subject: [edk2] [PATCH] ArmVirtPkg/ArmVirtQemu ARM: work around KVM limitations in LTO build X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lersek@redhat.com, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" KVM on ARM refuses to decode load/store instructions used to perform I/O to emulated devices, and instead relies on the exception syndrome information to describe the operand register, access size, etc. This is only possible for instructions that have a single input/output register (as opposed to ones that increment the offset register, or load/store pair instructions, etc). Otherwise, QEMU crashes with the following error error: kvm run failed Function not implemented R00=01010101 R01=00000008 R02=00000048 R03=08000820 R04=00000120 R05=7faaa0e0 R06=7faaa0dc R07=7faaa0e8 R08=7faaa0ec R09=7faaa088 R10=000000ff R11=00000080 R12=ff000000 R13=7fccfe08 R14=7faa835f R15=7faa887c PSR=800001f3 N--- T svc32 QEMU: Terminated and KVM produces a warning such as the following in the kernel log kvm [17646]: load/store instruction decoding not implemented GCC with LTO enabled will emit such instructions for Mmio[Read|Write] invocations performed in a loop, so we need to disable LTO for the IoLib library to ensure that the emitted instructions are suitable for emulated I/O under KVM Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemu.dsc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index d74feb709cd1..e6e3d82d6ca9 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -414,3 +414,21 @@ [Components.AARCH64] NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf } + +[Components.ARM] + MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf { + + // + // KVM on ARM refuses to decode load/store instructions used to perform + // I/O to emulated devices, and instead relies on the exception syndrome + // information to describe the operand register, access size, etc. + // This is only possible for instructions that have a single input/output + // register (as opposed to ones that increment the offset register, or + // load/store pair instructions, etc). + // GCC with LTO enabled will emit such instructions for Mmio[Read|Write] + // invocations performed in a loop, so we need to disable LTO for this + // library to ensure that the emitted instructions are suitable for + // emulated I/O under KVM + // + GCC:*_GCC5_ARM_CC_FLAGS = -fno-lto + }