From patchwork Wed Jan 22 01:58:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 11344979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF89E1398 for ; Wed, 22 Jan 2020 05:14:52 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9911224656 for ; Wed, 22 Jan 2020 05:14:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DqogCYDG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9911224656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iu8L7-00056c-0q; Wed, 22 Jan 2020 05:14:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iu5K9-00066g-4j for xen-devel@lists.xenproject.org; Wed, 22 Jan 2020 02:00:53 +0000 X-Inumbo-ID: fc63cb50-3cba-11ea-aecd-bc764e2007e4 Received: from mail-yw1-xc41.google.com (unknown [2607:f8b0:4864:20::c41]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fc63cb50-3cba-11ea-aecd-bc764e2007e4; Wed, 22 Jan 2020 02:00:38 +0000 (UTC) Received: by mail-yw1-xc41.google.com with SMTP id 10so2495911ywv.5 for ; Tue, 21 Jan 2020 18:00:38 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=SaWxfqJm41og76Jm8+3U0jfqiLqBbAIVCGxH45ZlXVE=; b=DqogCYDGO7HOA7o00P5BDVsVGvegQSD5WVxKJZYPUuuEmgjzIJz3H0TCVK+keK3ZzE wwWFN56Uts9hlpjKzESUphReFBZRB6Mhru5pdPivWp11IinKXJRGZbUGGjlznIM3QVcS vtbt2Gt/VyMf+6w95O+edtJMmP0c+GGypUl7dOF/Bk54Ots5HpLxzNG3dQaXbaptsmL2 TUX5ErMK2eR1Vw6AJUpn2zDyLn/D5d3m8hoYIzw1C19LPk4DGRrgiglJetJZrHM2rJMZ XMq77AB8OlsO5spvnkGdAxMc8m7GAon5YxGoFebqPEusJbC0SaHzBAINKHMPpsTjRFZi Q73g== 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:mime-version:content-transfer-encoding; bh=SaWxfqJm41og76Jm8+3U0jfqiLqBbAIVCGxH45ZlXVE=; b=HRmR19Axt+uAM/r+JNyQH1Ozjbd64R+CEVPdAWvlgIruHKDzIgO1V0pGGuRw4DNQOX r+n1Nvs7eXCfS+nwl5/qChNI7UVallm5pQFyyaKrtlNZXoBIITxU6pDvLLB8kv8tIpQY g51nshXJBwf4hgGN+ZHVIm86ud+d2GFuBCJsxNtUK69Q9ta31aeQBC/x/J3cAW5ZGsPS 2JGDRfyYKANtT47l4okqaBofh99UbvvIA3r8mwU3X9Zc9PZKKbPhxEr8lpZHOlfesJ3r IYZDlhfkQKwosIoxWFds8xzGkq8awFf8JhOOa3r4JZ91avP8Abks8UKNZjCLoh6AsP8u Ou5g== X-Gm-Message-State: APjAAAVC5jYZnROCkEGGQvjYClpjkqJECfajxBBGy7n+N/iXREs7Htod aC3wJO/u3fkNnufFnD99PJJXDqjjqLIgjA== X-Google-Smtp-Source: APXvYqwI4dO/6vXrjh2FJiTrFN0JiKfKeVXlZCVjXDH+J4MZdxnZVsVMah/rpXTf0ZgQWC6hOc1PKw== X-Received: by 2002:a81:4f56:: with SMTP id d83mr5506611ywb.39.1579658437784; Tue, 21 Jan 2020 18:00:37 -0800 (PST) Received: from bobbye-pc.knology.net ([216.186.244.35]) by smtp.gmail.com with ESMTPSA id q185sm17504248ywh.61.2020.01.21.18.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 18:00:37 -0800 (PST) From: Bobby Eshleman To: xen-devel@lists.xenproject.org Date: Tue, 21 Jan 2020 19:58:45 -0600 Message-Id: X-Mailer: git-send-email 2.25.0 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 22 Jan 2020 05:14:01 +0000 Subject: [Xen-devel] [RFC XEN PATCH 06/23] riscv: Add riscv to tools/libxc header files X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Bobby Eshleman , Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Bobby Eshleman , Dan Robertson , Alistair Francis Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Alistair Francis Signed-off-by: Alistair Francis --- tools/libxc/include/xenctrl.h | 7 +++++ tools/libxc/xc_core.h | 2 ++ tools/libxc/xc_core_riscv.h | 57 +++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 tools/libxc/xc_core_riscv.h diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 75f191ae3a..4cbe35bb2b 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -83,6 +83,13 @@ #define xen_mb() asm volatile ("dmb sy" : : : "memory") #define xen_rmb() asm volatile ("dmb sy" : : : "memory") #define xen_wmb() asm volatile ("dmb sy" : : : "memory") +#elif defined(__riscv) +#define RISCV_FENCE(p, s) \ + __asm__ __volatile__ ("fence " #p "," #s : : : "memory") + +#define xen_mb() RISCV_FENCE(rw,rw) +#define xen_rmb() RISCV_FENCE(r,r) +#define xen_wmb() RISCV_FENCE(w,w) #else #error "Define barriers" #endif diff --git a/tools/libxc/xc_core.h b/tools/libxc/xc_core.h index ed7ed53ca5..7baba3e4bd 100644 --- a/tools/libxc/xc_core.h +++ b/tools/libxc/xc_core.h @@ -155,6 +155,8 @@ int xc_core_arch_get_scratch_gpfn(xc_interface *xch, uint32_t domid, # include "xc_core_x86.h" #elif defined (__arm__) || defined(__aarch64__) # include "xc_core_arm.h" +#elif defined(__riscv) +# include "xc_core_riscv.h" #else # error "unsupported architecture" #endif diff --git a/tools/libxc/xc_core_riscv.h b/tools/libxc/xc_core_riscv.h new file mode 100644 index 0000000000..353020576e --- /dev/null +++ b/tools/libxc/xc_core_riscv.h @@ -0,0 +1,57 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; If not, see . + * + */ + +#ifndef XC_CORE_RISCV_H +#define XC_CORE_RISCV_H + +#define ELF_ARCH_DATA ELFDATA2LSB +#define ELF_ARCH_MACHINE EM_RISCV + +struct xc_core_arch_context { + /* nothing */ +}; + +#define xc_core_arch_context_init(arch_ctxt) do {} while (0) +#define xc_core_arch_context_free(arch_ctxt) do {} while (0) +#define xc_core_arch_context_get(arch_ctxt, ctxt, xch, domid) \ + (0) +#define xc_core_arch_context_dump(xch, arch_ctxt, args, dump_rtn) (0) + +int +xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt, + unsigned long pfn); +static inline int +xc_core_arch_context_get_shdr(xc_interface *xch, + struct xc_core_arch_context *arch_ctxt, + struct xc_core_section_headers *sheaders, + struct xc_core_strtab *strtab, + uint64_t *filesz, uint64_t offset) +{ + *filesz = 0; + return 0; +} + +#endif /* XC_CORE_RISCV_H */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */