From patchwork Fri May 12 23:36:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 761877 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wPmbV2YVwz9s7w for ; Sat, 13 May 2017 09:37:08 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="WsdCks7I"; dkim-atps=neutral Received: from localhost ([::1]:55662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9K7N-0006MJ-V2 for incoming@patchwork.ozlabs.org; Fri, 12 May 2017 19:37:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9K6m-0006LM-S8 for qemu-devel@nongnu.org; Fri, 12 May 2017 19:36:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9K6i-0007qf-Cv for qemu-devel@nongnu.org; Fri, 12 May 2017 19:36:28 -0400 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:36594) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d9K6i-0007q5-5z; Fri, 12 May 2017 19:36:24 -0400 Received: by mail-lf0-x242.google.com with SMTP id h4so1188986lfj.3; Fri, 12 May 2017 16:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=twuKJWiR3/yK+bOmrKiYcpmHKmVnugQVZrIeynHiI8g=; b=WsdCks7I3cPljkh84HJlVFo2Ww7A2myQx4HqYBlvLYYvM/jsG24tSWe+x81IBjzY5N H1Fx0++cGYbZ0KJDt4Oe2L5b9AUYFokRwZR8Ox4gcDg3ZMSFqFY/1RNmxxCc1BQYGhOI IPDmFa80A9tpfc1N/DAVdbPFpkVJwsk5I9+PLHDGdhs/3/p6UZNrXGY094BkAZcT9FDx gy+9tSiH+IH6t7saWEnwavHk/ZzzplvWgGlAMQoM9rMaSYNDcAskR0riAEW+XoMKGgFr V5H7aAwVClLdNCiWG3k/dOPXQJZaPlqPHEL7+iZrJG5ulPCh1zqrIf+0AD83oh8irZCc 97tQ== 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:in-reply-to :references; bh=twuKJWiR3/yK+bOmrKiYcpmHKmVnugQVZrIeynHiI8g=; b=l5tQyz0t9H58ulP4UH7BLquZz89hndm2J3wBc9Drwwk6kXzOuMDNmI3Owj4/E6aATS noHt0VP43ji2tbrZBnz+v5Kw5zF86ps2J1WfnkJJQT7jId9BWdNClKvxVhLgsQg/qNtl twdXlmDKVdEhXGJFILTuYFzs6moTWJsBZnHQ/iNztthWEPXiti0fkpWX1BJXAsmLln9r VO+jTdoXI7hmt9ij/eflLNHMhNtxW+kspGUdhF121nz6JQ9tC/xSQe2AfjIGivEPFcBZ WX5h2LeJWlE7w2hrJv84SXwNw5HsU7U7mc8b/cWuVjB2ucaSxHZcIC90DbIMypHq0nFa 4lTg== X-Gm-Message-State: AODbwcCq3bhG0EfTBzm73k59g9MoIhEz/sf0FbdF0OAWQKqLNaGr6ShR w4QtxsM3MPkizQ== X-Received: by 10.25.154.130 with SMTP id c124mr2273338lfe.71.1494632182870; Fri, 12 May 2017 16:36:22 -0700 (PDT) Received: from octofox.metropolis ([5.19.183.212]) by smtp.gmail.com with ESMTPSA id n79sm796790lfi.53.2017.05.12.16.36.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 May 2017 16:36:22 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 16:36:02 -0700 Message-Id: <1494632164-23799-2-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1494632164-23799-1-git-send-email-jcmvbkbc@gmail.com> References: <1494632164-23799-1-git-send-email-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PATCH 1/3] target/xtensa: fix mapping direction in read/write simcalls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Read and write simcalls map physical memory to access I/O buffers, but 'read' simcall need to map it for writing and 'write' simcall need to map it for reading, i.e. the opposite of what they do now. Fix that. Cc: qemu-stable@nongnu.org Signed-off-by: Max Filippov --- target/xtensa/xtensa-semi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c index a888a9d..98ae28c 100644 --- a/target/xtensa/xtensa-semi.c +++ b/target/xtensa/xtensa-semi.c @@ -173,7 +173,7 @@ void HELPER(simcall)(CPUXtensaState *env) TARGET_PAGE_SIZE - (vaddr & (TARGET_PAGE_SIZE - 1)); uint32_t io_sz = page_left < len ? page_left : len; hwaddr sz = io_sz; - void *buf = cpu_physical_memory_map(paddr, &sz, is_write); + void *buf = cpu_physical_memory_map(paddr, &sz, !is_write); if (buf) { vaddr += io_sz; @@ -182,7 +182,7 @@ void HELPER(simcall)(CPUXtensaState *env) write(fd, buf, io_sz) : read(fd, buf, io_sz); regs[3] = errno_h2g(errno); - cpu_physical_memory_unmap(buf, sz, is_write, sz); + cpu_physical_memory_unmap(buf, sz, !is_write, sz); if (regs[2] == -1) { break; }