Received: by 10.223.164.202 with SMTP id h10csp298276wrb; Wed, 8 Nov 2017 16:54:52 -0800 (PST) X-Google-Smtp-Source: ABhQp+Q4MrVXN8huIlT3XzNATLeE5l9cB7I40wZFwow4nYGfrErxAYZJVDDDi0/xOzQ+GNSr80nL X-Received: by 10.101.93.132 with SMTP id f4mr1638628pgt.152.1510188892504; Wed, 08 Nov 2017 16:54:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510188892; cv=none; d=google.com; s=arc-20160816; b=ILfBMv8vkNZSEkMmg5xKB9Bd4fem6zMbSVpB7BsejTQqlvb58GHUA0bguuL10CCGzI aXyE3ZQH2cp03Eb1zElDdbr1rRiaVAbLFnqLI1m9NnzG/eYejUOkYda9GbvAeIK7TUs5 +51lRmeg7CS0V6yFlMf9DaZxs+Up30IecLKGP4LoZmdJ5OEOonld7ew86V9dGKObFF87 KIIruiUd0IvpSBWYZjk2/eiWsFrY/7rTYpdR0kwjNjhneSEPHTwqtgvqCqqvBjrkXKY/ VZe8dGjqCzTcnADDBnWAXNDEbkJTOxW7DjWsYOlW3+0D+chRTOWB2HN+UebuadF8IIbu tGmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ZdxxpzyVo8L/0iv2itn2BcJbM1eyksWoYsroXQLjyPM=; b=ym/xYbjkLuNnEpo66RpEfDgblLLsf2c4DsK/3+n2odhCLNEMpuhnbeaHVmn2LKjCmy TVElK/Yy/JyJToWdoh/uHQzcZgazEtRdNPzuTK/YPBC//86/EfamlYnZpFRA5C9m8eL9 Iwl19dSsPGCWZJp/+LAoXQIaii24GB4ZR0TYnX7L5A74+qLH9da9++iX+LbRBRHPijek Fbgg0vs8zA2DId9bNt8UyTEKJo8gOctt3Ser/Zd/f6WsFcEN0SJEyaUkH197XXtAS8LG EhMxOTAlBDAIUhaNBg5wFUtXWIo5O3Q7sk/XMDrospRt8EY8bQEBmmVCD84x2C20+Pxe eHrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=T9D8klh7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6si4989926pgo.198.2017.11.08.16.54.41; Wed, 08 Nov 2017 16:54:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=T9D8klh7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753525AbdKIAxq (ORCPT + 84 others); Wed, 8 Nov 2017 19:53:46 -0500 Received: from mail-by2nam01on0048.outbound.protection.outlook.com ([104.47.34.48]:50627 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753402AbdKIAwJ (ORCPT ); Wed, 8 Nov 2017 19:52:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ZdxxpzyVo8L/0iv2itn2BcJbM1eyksWoYsroXQLjyPM=; b=T9D8klh75dDtQ54D4mdVRgvqfp4E0UVXcAtRdrMl1jgcBkY0hH7e3ZhpF2vnzVHnnmWa7PLSJces8IGtuWwEHjMqJVQ+qerBbCZH3lT+kXpI6n//wnBJGPapHr2ra0mhCkTTKHqwVB/2HV2WdKYclqII2x9nStuKu68yRPDhBF8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=David.Daney@cavium.com; Received: from ddl.caveonetworks.com (50.233.148.156) by CY4PR07MB3495.namprd07.prod.outlook.com (10.171.252.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Thu, 9 Nov 2017 00:52:05 +0000 From: David Daney To: linux-mips@linux-mips.org, ralf@linux-mips.org, James Hogan , netdev@vger.kernel.org, "David S. Miller" , Rob Herring , Mark Rutland , devel@driverdev.osuosl.org, Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Steven J. Hill" , devicetree@vger.kernel.org, Andrew Lunn , Florian Fainelli , David Daney , Carlos Munoz Subject: [PATCH v2 5/8] MIPS: Octeon: Automatically provision CVMSEG space. Date: Wed, 8 Nov 2017 16:51:23 -0800 Message-Id: <20171109005126.21341-6-david.daney@cavium.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171109005126.21341-1-david.daney@cavium.com> References: <20171109005126.21341-1-david.daney@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: SN4PR0701CA0022.namprd07.prod.outlook.com (10.161.192.160) To CY4PR07MB3495.namprd07.prod.outlook.com (10.171.252.152) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3d550d4-9741-42de-e062-08d5270c19f3 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199);SRVR:CY4PR07MB3495; X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB3495;3:/589jhaYPp8fl4vm5cQO0scQKmsFw5VB3Byw2A/4onqTUAXjbObjIJF3HY8+QN+QKpM0WO8yNatnUQAn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HeW30Mm+83hHS1MYGuuZbURhK3rjwXRHWLOssF8jepPnHx4uvObYr8/9DEY6QL1SjwBnGMR0MSlaWORxwVJXtv6/LKhRtGsvJFJl+wYWTWWS+S9zPXm4hyfdYHUDL+CYWLjKaQUUjtGJIPcqiTcSZeBMLM3E0amQ/EhdeFUcLnDBrs5AV9Q937GN6TbqTiqflh2OhD6CzeTiWYq/9W0fJmO09fPnduGvyUVdIFMveJ4XYLsz9YWpx8crbwzCQNg36N5ECEb7pcf6VH;4:SVAiPl0od6ax1oklfUamRuqExck/6HZAUy8BWv/8IyK9v8w+UmmurZipDN3Vx6CaO80k9WEt0TxTJ18ku1WhKC9OEGZ20oX7CABwVZ4v+rnCw44oxfV9DbHSVwO5NY15tAgSZgV15ZpilDZCnnxm0t9oQLTDkk1vVUcu9Kts+ndfVuESKx183MSu3LMUvnSB062pBMZgpl3+KXJf4t5r+vkBX05A5ylZfP6xez45JH+SAfZAdNcUEzXo9bRO6bWlN6MG3b+LVdkK7ZomnKFYLA== X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3231021)(93006095)(93001095)(3002001)(100000703101)(100105400095)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR07MB3495;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR07MB3495; X-Forefront-PRVS: 0486A0CB86 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(346002)(376002)(189002)(199003)(53936002)(6486002)(50466002)(6506006)(110136005)(2950100002)(36756003)(33646002)(7736002)(54906003)(50986999)(106356001)(189998001)(66066001)(2906002)(25786009)(305945005)(7416002)(97736004)(76176999)(1076002)(48376002)(47776003)(105586002)(16526018)(3846002)(81156014)(6512007)(81166006)(6116002)(8936002)(5003940100001)(101416001)(8676002)(478600001)(53416004)(316002)(6666003)(50226002)(72206003)(4326008)(69596002)(5660300001)(68736007)(16586007)(39060400002)(86362001)(107886003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB3495;H:ddl.caveonetworks.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR07MB3495;23:m/FTQAodAN9/UXCkzfKMxJOMcSboxSeJ/GyZupPBp?= =?us-ascii?Q?I4j018IZ/ZOMW5mHbKHnfG0SlK5NsBMEoQb3mH5J04EQG3D7jBe9GCN68Dvg?= =?us-ascii?Q?2vP7ZEcWBl3gSpwltFaQ2Zr1QIMRUEfWraE03cKuer0eSyrKZimQXl74XerC?= =?us-ascii?Q?PGxAyPxE3PIkpu9JSNhMkjLWwIJL7ADXChV6zfQuqLN+diD0Ploh4Hn4gbPS?= =?us-ascii?Q?PuEiVoGUsQuTtDxlJY454cOMTKUNDEPuZM35boo3+t+TKctXfuM72D1RRZt1?= =?us-ascii?Q?+aeaQ0E6KpknRiKQ8BoKzMSh3Kd+mF+GCnUQkkKTG8xaE28h60rPRQQOzgba?= =?us-ascii?Q?kNUaSSCzji4+3/vvofTWUeR/0x/rNLPwDdfpNXZpoU5q1eTeqXll64tlTEDx?= =?us-ascii?Q?gQbD1rPCis2oJKaLwUTEaFXhFcjTGiqH3PJH6c+k2wDiPhd85Ce1PYXAMgmq?= =?us-ascii?Q?N8KeyEbLmpoE/gHo0UNlOMLUZl7ynWgeKEpxCx0vcy2EUwXY5Nwg1kX0Uc1W?= =?us-ascii?Q?qy+S2xFbcDSzL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jzE1Aj7+SvyUsppFdZdgIYRCWQgNHTYGiAspIpwERxOeGOzVZOrSklYwkKjGhVFfBy+ffFsrcqew8Y4L+gd6VwRCU2cyXVL3iYI27JWp7T+gHOHFY4E/GIB+UhhOYwaRv8dDgfoxDEonhljTzHkjG5JgBDeFWzBzPiQzUNqJWMjwepOBm64aFNy1UPtJQVF4x6bs8+vPTIf/+X/6g=;5:C8u7ExqlGZuvzE3klIHn4/AbdFZQZqC7yN7Mu1S8cOSGEjN8shL1L/+DJcrIJ/P/bcdNPRZIO8UXHr0pjO6gwgKc6VRBAaIwgesAXyKZxOPJWsL9s5FEvyFUBitmfTWfjy/LAJ2GuTKOrL8OP1EOlDCKFNx2nh7setdOOke1U9Q=;24:9yEwz9UhjR5N/VUjUS4FR9Nfwstj323GO7OCsnOW/jiHc429VRiBfznFaPvv62FfSRXpQSOWKa42afpsVPWGu/8kaiI1/6lwbjxOKp7YJOI=;7:C7W62ytIWeO5aFQg8GMuP25SNV6+bFcERAlcFD40Kgsfbsr7klQOqPRMuzIABn1DrGGHxgxXxlcql9yQYBARIXrSvoE4KBPB5cqCW0cYzH4/8xiiZPXdjbv2b8evTieasYSbcQnUaIrgobZqdGLQZqV5Ls/2t4hHajBLdJPmbo6+HsCBU2kKMx0HayQgc46VxWt39m1rX744nQjD48eZrCBVkS4mrwm1WrOSV3N0MU75D/ioLfXn2Q6oC2ZW69ui SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2017 00:52:05.8297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3d550d4-9741-42de-e062-08d5270c19f3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3495 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE and automatically calculate the amount of CVMSEG space needed. 1st 128-bytes: Use by IOBDMA 2nd 128-bytes: Reserved by kernel for scratch/TLS emulation. 3rd 128-bytes: OCTEON-III LMTLINE New config variable CONFIG_CAVIUM_OCTEON_EXTRA_CVMSEG provisions additional lines, defaults to zero. Signed-off-by: David Daney Signed-off-by: Carlos Munoz --- arch/mips/cavium-octeon/Kconfig | 27 ++++++++++++-------- arch/mips/cavium-octeon/setup.c | 16 ++++++------ .../asm/mach-cavium-octeon/kernel-entry-init.h | 20 +++++++++------ arch/mips/include/asm/mipsregs.h | 2 ++ arch/mips/include/asm/octeon/octeon.h | 2 ++ arch/mips/include/asm/processor.h | 2 +- arch/mips/kernel/octeon_switch.S | 2 -- arch/mips/mm/tlbex.c | 29 ++++++---------------- drivers/staging/octeon/ethernet-defines.h | 2 +- 9 files changed, 50 insertions(+), 52 deletions(-) diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig index 4dffe78fe6b9..a526bb80aa16 100644 --- a/arch/mips/cavium-octeon/Kconfig +++ b/arch/mips/cavium-octeon/Kconfig @@ -10,21 +10,26 @@ config CAVIUM_CN63XXP1 non-CN63XXP1 hardware, so it is recommended to select "n" unless it is known the workarounds are needed. -config CAVIUM_OCTEON_CVMSEG_SIZE - int "Number of L1 cache lines reserved for CVMSEG memory" - range 0 54 - default 1 - help - CVMSEG LM is a segment that accesses portions of the dcache as a - local memory; the larger CVMSEG is, the smaller the cache is. - This selects the size of CVMSEG LM, which is in cache blocks. The - legally range is from zero to 54 cache blocks (i.e. CVMSEG LM is - between zero and 6192 bytes). - endif # CPU_CAVIUM_OCTEON if CAVIUM_OCTEON_SOC +config CAVIUM_OCTEON_EXTRA_CVMSEG + int "Number of extra L1 cache lines reserved for CVMSEG memory" + range 0 50 + default 0 + help + CVMSEG LM is a segment that accesses portions of the dcache + as a local memory; the larger CVMSEG is, the smaller the + cache is. The kernel uses two or three blocks (one for TLB + exception handlers, one for driver IOBDMA operations, and on + models that need it, one for LMTDMA operations). This + selects an optional extra number of CVMSEG lines for use by + other software. + + Normally no extra lines are required, and this parameter + should be set to zero. + config CAVIUM_OCTEON_LOCK_L2 bool "Lock often used kernel code in the L2" default "y" diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index 99e6a68bc652..51c4d3c3cada 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c @@ -68,6 +68,12 @@ extern void pci_console_init(const char *arg); static unsigned long long max_memory = ULLONG_MAX; static unsigned long long reserve_low_mem; +/* + * modified in hernel-entry-init.h, must have an initial value to keep + * it from being clobbered when bss is zeroed. + */ +u32 octeon_cvmseg_lines = 2; + DEFINE_SEMAPHORE(octeon_bootbus_sem); EXPORT_SYMBOL(octeon_bootbus_sem); @@ -604,11 +610,7 @@ void octeon_user_io_init(void) /* R/W If set, CVMSEG is available for loads/stores in * kernel/debug mode. */ -#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 cvmmemctl.s.cvmsegenak = 1; -#else - cvmmemctl.s.cvmsegenak = 0; -#endif if (OCTEON_IS_OCTEON3()) { /* Enable LMTDMA */ cvmmemctl.s.lmtena = 1; @@ -626,9 +628,9 @@ void octeon_user_io_init(void) /* Setup of CVMSEG is done in kernel-entry-init.h */ if (smp_processor_id() == 0) - pr_notice("CVMSEG size: %d cache lines (%d bytes)\n", - CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE, - CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE * 128); + pr_notice("CVMSEG size: %u cache lines (%u bytes)\n", + octeon_cvmseg_lines, + octeon_cvmseg_lines * 128); if (octeon_has_feature(OCTEON_FEATURE_FAU)) { union cvmx_iob_fau_timeout fau_timeout; diff --git a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h index c38b38ce5a3d..cdcca60978a2 100644 --- a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h @@ -26,11 +26,18 @@ # a3 = address of boot descriptor block .set push .set arch=octeon + mfc0 v1, CP0_PRID_REG + andi v1, 0xff00 + li v0, 0x9500 # cn78XX or later + subu v1, v1, v0 + li t2, 2 + CONFIG_CAVIUM_OCTEON_EXTRA_CVMSEG + bltz v1, 1f + addiu t2, 1 # t2 has cvmseg_size +1: # Read the cavium mem control register dmfc0 v0, CP0_CVMMEMCTL_REG # Clear the lower 6 bits, the CVMSEG size - dins v0, $0, 0, 6 - ori v0, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE + dins v0, t2, 0, 6 dmtc0 v0, CP0_CVMMEMCTL_REG # Write the cavium mem control register dmfc0 v0, CP0_CVMCTL_REG # Read the cavium control register # Disable unaligned load/store support but leave HW fixup enabled @@ -70,7 +77,7 @@ # Flush dcache after config change cache 9, 0($0) # Zero all of CVMSEG to make sure parity is correct - dli v0, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE + move v0, t2 dsll v0, 7 beqz v0, 2f 1: dsubu v0, 8 @@ -126,12 +133,7 @@ LONG_L sp, (t0) # Set the SP global variable to zero so the master knows we've started LONG_S zero, (t0) -#ifdef __OCTEON__ - syncw - syncw -#else sync -#endif # Jump to the normal Linux SMP entry point j smp_bootstrap nop @@ -148,6 +150,8 @@ #endif /* CONFIG_SMP */ octeon_main_processor: + dla v0, octeon_cvmseg_lines + sw t2, 0(v0) .set pop .endm diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index a6810923b3f0..df7654d7333d 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h @@ -1126,6 +1126,8 @@ #define FPU_CSR_RD 0x3 /* towards -Infinity */ +#define CAVIUM_OCTEON_SCRATCH_OFFSET (2 * 128 - 16 - 32768) + #ifndef __ASSEMBLY__ /* diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h index d184592e6515..02eb194b2cdc 100644 --- a/arch/mips/include/asm/octeon/octeon.h +++ b/arch/mips/include/asm/octeon/octeon.h @@ -392,6 +392,8 @@ static inline uint32_t octeon_npi_read32(uint64_t address) extern struct cvmx_bootinfo *octeon_bootinfo; +extern u32 octeon_cvmseg_lines; + extern uint64_t octeon_bootloader_entry_addr; extern void (*octeon_irq_setup_secondary)(void); diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index 95b8c471f572..3d264008afcb 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h @@ -216,7 +216,7 @@ struct octeon_cop2_state { .cp2 = {0,}, struct octeon_cvmseg_state { - unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE] + unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_EXTRA_CVMSEG + 3] [cpu_dcache_line_size() / sizeof(unsigned long)]; }; diff --git a/arch/mips/kernel/octeon_switch.S b/arch/mips/kernel/octeon_switch.S index e42113fe2762..4f56902d5ee7 100644 --- a/arch/mips/kernel/octeon_switch.S +++ b/arch/mips/kernel/octeon_switch.S @@ -29,7 +29,6 @@ cpu_save_nonscratch a0 LONG_S ra, THREAD_REG31(a0) -#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 /* Check if we need to store CVMSEG state */ dmfc0 t0, $11,7 /* CvmMemCtl */ bbit0 t0, 6, 3f /* Is user access enabled? */ @@ -58,7 +57,6 @@ dmfc0 t0, $11,7 /* CvmMemCtl */ xori t0, t0, 0x40 /* Bit 6 is CVMSEG user enable */ dmtc0 t0, $11,7 /* CvmMemCtl */ -#endif 3: #if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 79b9f2ad3ff5..3d3dfba465ae 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c @@ -115,33 +115,17 @@ static int use_lwx_insns(void) return 0; } } -#if defined(CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE) && \ - CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 -static bool scratchpad_available(void) -{ - return true; -} -static int scratchpad_offset(int i) -{ - /* - * CVMSEG starts at address -32768 and extends for - * CAVIUM_OCTEON_CVMSEG_SIZE 128 byte cache lines. - */ - i += 1; /* Kernel use starts at the top and works down. */ - return CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE * 128 - (8 * i) - 32768; -} -#else -static bool scratchpad_available(void) -{ - return false; -} + static int scratchpad_offset(int i) { + if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON)) + return (CAVIUM_OCTEON_SCRATCH_OFFSET - (8 * i)); + BUG(); /* Really unreachable, but evidently some GCC want this. */ return 0; } -#endif + /* * Found by experiment: At least some revisions of the 4kc throw under * some circumstances a machine check exception, triggered by invalid @@ -1302,7 +1286,8 @@ static void build_r4000_tlb_refill_handler(void) memset(relocs, 0, sizeof(relocs)); memset(final_handler, 0, sizeof(final_handler)); - if (IS_ENABLED(CONFIG_64BIT) && (scratch_reg >= 0 || scratchpad_available()) && use_bbit_insns()) { + if (IS_ENABLED(CONFIG_64BIT) && use_bbit_insns() && + (scratch_reg >= 0 || IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON))) { htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1, scratch_reg); vmalloc_mode = refill_scratch; diff --git a/drivers/staging/octeon/ethernet-defines.h b/drivers/staging/octeon/ethernet-defines.h index 07bd2b87f6a0..e898df25b87f 100644 --- a/drivers/staging/octeon/ethernet-defines.h +++ b/drivers/staging/octeon/ethernet-defines.h @@ -32,7 +32,7 @@ #define REUSE_SKBUFFS_WITHOUT_FREE 1 #endif -#define USE_ASYNC_IOBDMA (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0) +#define USE_ASYNC_IOBDMA 1 /* Maximum number of SKBs to try to free per xmit packet. */ #define MAX_OUT_QUEUE_DEPTH 1000 -- 2.13.6 From 1583564052744447869@xxx Thu Nov 09 05:12:45 +0000 2017 X-GM-THRID: 1583564052744447869 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread