| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 3 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 4 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 5 | | - * (at your option) any later version. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 8 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 9 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 10 | | - * GNU General Public License for more details. |
|---|
| 11 | | - * |
|---|
| 12 | | - * You should have received a copy of the GNU General Public License |
|---|
| 13 | | - * along with this program; if not, write to the Free Software |
|---|
| 14 | | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 15 | 3 | * |
|---|
| 16 | 4 | * Copyright (C) IBM Corporation, 2012 |
|---|
| 17 | 5 | * |
|---|
| .. | .. |
|---|
| 27 | 15 | * int __kernel_getcpu(unsigned *cpu, unsigned *node); |
|---|
| 28 | 16 | * |
|---|
| 29 | 17 | */ |
|---|
| 18 | +#if defined(CONFIG_PPC64) |
|---|
| 30 | 19 | V_FUNCTION_BEGIN(__kernel_getcpu) |
|---|
| 31 | 20 | .cfi_startproc |
|---|
| 32 | 21 | mfspr r5,SPRN_SPRG_VDSO_READ |
|---|
| .. | .. |
|---|
| 36 | 25 | rlwinm r7,r5,16,31-15,31-0 |
|---|
| 37 | 26 | beq cr0,1f |
|---|
| 38 | 27 | stw r6,0(r3) |
|---|
| 39 | | -1: beq cr1,2f |
|---|
| 40 | | - stw r7,0(r4) |
|---|
| 41 | | -2: crclr cr0*4+so |
|---|
| 28 | +1: crclr cr0*4+so |
|---|
| 42 | 29 | li r3,0 /* always success */ |
|---|
| 30 | + beqlr cr1 |
|---|
| 31 | + stw r7,0(r4) |
|---|
| 43 | 32 | blr |
|---|
| 44 | 33 | .cfi_endproc |
|---|
| 45 | 34 | V_FUNCTION_END(__kernel_getcpu) |
|---|
| 35 | +#elif !defined(CONFIG_SMP) |
|---|
| 36 | +V_FUNCTION_BEGIN(__kernel_getcpu) |
|---|
| 37 | + .cfi_startproc |
|---|
| 38 | + cmpwi cr0, r3, 0 |
|---|
| 39 | + cmpwi cr1, r4, 0 |
|---|
| 40 | + li r5, 0 |
|---|
| 41 | + beq cr0, 1f |
|---|
| 42 | + stw r5, 0(r3) |
|---|
| 43 | +1: li r3, 0 /* always success */ |
|---|
| 44 | + crclr cr0*4+so |
|---|
| 45 | + beqlr cr1 |
|---|
| 46 | + stw r5, 0(r4) |
|---|
| 47 | + blr |
|---|
| 48 | + .cfi_endproc |
|---|
| 49 | +V_FUNCTION_END(__kernel_getcpu) |
|---|
| 50 | +#endif |
|---|