Skip to content

Commit 8ad8d24

Browse files
committed
Merge tag 'parisc-for-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc updates from Helge Deller: - Fix device reference leak in error path - Check if system provides a 64-bit free running platform counter - Minor fixes in debug code * tag 'parisc-for-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: lba_pci: Add debug code to show IO and PA ranges parisc: Detect 64-bit free running platform counter parisc: Fix minor printk issues in iosapic debug code parisc: Enhance debug code for PAT firmware parisc: Add PDC PAT call to get free running 64-bit counter parisc: Fix module path output in qemu tables parisc: Export model name for MPE/ix parisc: Prevent interrupts during reboot parisc: Print hardware IDs as 4 digit hex strings parisc: kernel: replace kfree() with put_device() in create_tree_node()
2 parents 6589b3d + 1651d69 commit 8ad8d24

9 files changed

Lines changed: 104 additions & 29 deletions

File tree

arch/parisc/include/asm/pdcpat.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
#define PDC_PAT_PD 74L /* Protection Domain Info */
180180
#define PDC_PAT_PD_GET_ADDR_MAP 0L /* Get Address Map */
181181
#define PDC_PAT_PD_GET_PDC_INTERF_REV 1L /* Get PDC Interface Revisions */
182+
#define PDC_PAT_PD_GET_PLATFORM_COUNTER 10L /* Get 64-bit free running counter */
182183

183184
#define PDC_PAT_CAPABILITY_BIT_PDC_SERIALIZE (1UL << 0)
184185
#define PDC_PAT_CAPABILITY_BIT_PDC_POLLING (1UL << 1)
@@ -373,9 +374,11 @@ extern int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
373374
unsigned long count, unsigned long offset);
374375
extern int pdc_pat_pd_get_pdc_revisions(unsigned long *legacy_rev,
375376
unsigned long *pat_rev, unsigned long *pdc_cap);
377+
extern int pdc_pat_pd_get_platform_counter(uint64_t **addr,
378+
unsigned long *freq, unsigned long *uniq);
376379

377-
extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val);
378-
extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val);
380+
extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val);
381+
extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val);
379382

380383
extern int pdc_pat_mem_pdt_info(struct pdc_pat_mem_retinfo *rinfo);
381384
extern int pdc_pat_mem_pdt_cell_info(struct pdc_pat_mem_cell_pdt_retinfo *rinfo,

arch/parisc/kernel/drivers.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static struct parisc_device * __init create_tree_node(char id,
435435
dev->dev.dma_mask = &dev->dma_mask;
436436
dev->dev.coherent_dma_mask = dev->dma_mask;
437437
if (device_register(&dev->dev)) {
438-
kfree(dev);
438+
put_device(&dev->dev);
439439
return NULL;
440440
}
441441

@@ -916,14 +916,18 @@ static __init void qemu_header(void)
916916
{
917917
int num;
918918
unsigned long *p;
919+
char name_mpe[80];
919920

920921
pr_info("--- cut here ---\n");
921922
pr_info("/* AUTO-GENERATED HEADER FILE FOR SEABIOS FIRMWARE */\n");
922923
pr_cont("/* generated with Linux kernel */\n");
923924
pr_cont("/* search for PARISC_QEMU_MACHINE_HEADER in Linux */\n\n");
924925

925-
pr_info("#define PARISC_MODEL \"%s\"\n\n",
926+
pr_info("#define PARISC_MODEL \"%s\"\n",
926927
boot_cpu_data.pdc.sys_model_name);
928+
strcpy(name_mpe, boot_cpu_data.pdc.sys_model_name);
929+
pdc_model_sysmodel(OS_ID_MPEXL, name_mpe);
930+
pr_info("#define PARISC_MODEL_MPE \"%s\"\n\n", name_mpe);
927931

928932
#define p ((unsigned long *)&boot_cpu_data.pdc.model)
929933
pr_info("#define PARISC_PDC_MODEL 0x%lx, 0x%lx, 0x%lx, "
@@ -1036,14 +1040,14 @@ static __init int qemu_print_iodc_data(struct device *lin_dev, void *data)
10361040
"mod_path_hpa_%08lx = {\n", hpa);
10371041
pr_cont("\t.path = { ");
10381042
pr_cont(".flags = 0x%x, ", mod_path.path.flags);
1039-
pr_cont(".bc = { 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x }, ",
1043+
pr_cont(".bc = { 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x }, ",
10401044
(unsigned char)mod_path.path.bc[0],
10411045
(unsigned char)mod_path.path.bc[1],
10421046
(unsigned char)mod_path.path.bc[2],
10431047
(unsigned char)mod_path.path.bc[3],
10441048
(unsigned char)mod_path.path.bc[4],
10451049
(unsigned char)mod_path.path.bc[5]);
1046-
pr_cont(".mod = 0x%x }\n", mod_path.path.mod);
1050+
pr_cont(".mod = 0x%02x }\n", (unsigned char)mod_path.path.mod);
10471051
pr_cont("};\n");
10481052

10491053
pr_info("static struct pdc_iodc iodc_data_hpa_%08lx = {\n", hpa);

arch/parisc/kernel/firmware.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,11 +1643,36 @@ int pdc_pat_pd_get_pdc_revisions(unsigned long *legacy_rev,
16431643
return retval;
16441644
}
16451645

1646+
/**
1647+
* pdc_pat_pd_get_platform_counter - Retrieve address of free-running 64-bit counter.
1648+
* @addr: The address of the 64-bit counter.
1649+
* @freq: The frequency of the counter, or -1 if unknown.
1650+
* @unique: Although monotonic growing, may it return the same number twice?
1651+
*
1652+
*/
1653+
int pdc_pat_pd_get_platform_counter(uint64_t **addr,
1654+
unsigned long *freq, unsigned long *unique)
1655+
{
1656+
int retval;
1657+
unsigned long flags;
1658+
1659+
spin_lock_irqsave(&pdc_lock, flags);
1660+
retval = mem_pdc_call(PDC_PAT_PD, PDC_PAT_PD_GET_PLATFORM_COUNTER,
1661+
__pa(pdc_result));
1662+
if (retval == PDC_OK) {
1663+
*addr = (uint64_t *)pdc_result[0];
1664+
*freq = pdc_result[1];
1665+
*unique = pdc_result[2];
1666+
}
1667+
spin_unlock_irqrestore(&pdc_lock, flags);
1668+
1669+
return retval;
1670+
}
16461671

16471672
/**
16481673
* pdc_pat_io_pci_cfg_read - Read PCI configuration space.
16491674
* @pci_addr: PCI configuration space address for which the read request is being made.
1650-
* @pci_size: Size of read in bytes. Valid values are 1, 2, and 4.
1675+
* @pci_size: Size of read in bytes. Valid values are 1, 2, and 4.
16511676
* @mem_addr: Pointer to return memory buffer.
16521677
*
16531678
*/

arch/parisc/kernel/inventory.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,19 @@ pat_query_module(ulong pcell_loc, ulong mod_index)
207207
return status;
208208
}
209209

210+
#ifdef DEBUG_PAT
211+
pr_debug("PAT INDEX: %lu: cba 0x%lx, "
212+
"mod_info 0x%lx, mod_location 0x%lx, "
213+
"mod: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx "
214+
"0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
215+
mod_index + 1, pa_pdc_cell->cba,
216+
pa_pdc_cell->mod_info, pa_pdc_cell->mod_location,
217+
pa_pdc_cell->mod[0], pa_pdc_cell->mod[1], pa_pdc_cell->mod[2],
218+
pa_pdc_cell->mod[3], pa_pdc_cell->mod[4], pa_pdc_cell->mod[5],
219+
pa_pdc_cell->mod[6], pa_pdc_cell->mod[7], pa_pdc_cell->mod[8],
220+
pa_pdc_cell->mod[9], pa_pdc_cell->mod[10], pa_pdc_cell->mod[11]);
221+
#endif
222+
210223
temp = pa_pdc_cell->cba;
211224
dev = alloc_pa_dev(PAT_GET_CBA(temp), &(pa_pdc_cell->mod_path));
212225
if (!dev) {

arch/parisc/kernel/process.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ void machine_restart(char *cmd)
8585
#endif
8686
/* set up a new led state on systems shipped with a LED State panel */
8787
pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN);
88+
89+
/* prevent interrupts during reboot */
90+
set_eiem(0);
8891

8992
/* "Normal" system reset */
9093
pdc_do_reset();

arch/parisc/kernel/processor.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Initial setup-routines for HP 9000 based hardware.
44
*
55
* Copyright (C) 1991, 1992, 1995 Linus Torvalds
6-
* Modifications for PA-RISC (C) 1999-2008 Helge Deller <deller@gmx.de>
6+
* Modifications for PA-RISC (C) 1999-2026 Helge Deller <deller@gmx.de>
77
* Modifications copyright 1999 SuSE GmbH (Philipp Rumpf)
88
* Modifications copyright 2000 Martin K. Petersen <mkp@mkp.net>
99
* Modifications copyright 2000 Philipp Rumpf <prumpf@tux.org>
@@ -41,7 +41,7 @@ EXPORT_SYMBOL(_parisc_requires_coherency);
4141
DEFINE_PER_CPU(struct cpuinfo_parisc, cpu_data);
4242

4343
/*
44-
** PARISC CPU driver - claim "device" and initialize CPU data structures.
44+
** PARISC CPU driver - claim "device" and initialize CPU data structures.
4545
**
4646
** Consolidate per CPU initialization into (mostly) one module.
4747
** Monarch CPU will initialize boot_cpu_data which shouldn't
@@ -74,8 +74,8 @@ init_percpu_prof(unsigned long cpunum)
7474
* processor_probe - Determine if processor driver should claim this device.
7575
* @dev: The device which has been found.
7676
*
77-
* Determine if processor driver should claim this chip (return 0) or not
78-
* (return 1). If so, initialize the chip and tell other partners in crime
77+
* Determine if processor driver should claim this chip (return 0) or not
78+
* (return 1). If so, initialize the chip and tell other partners in crime
7979
* they have work to do.
8080
*/
8181
static int __init processor_probe(struct parisc_device *dev)
@@ -207,7 +207,7 @@ static int __init processor_probe(struct parisc_device *dev)
207207
}
208208
#endif
209209

210-
/*
210+
/*
211211
* Bring this CPU up now! (ignore bootstrap cpuid == 0)
212212
*/
213213
#ifdef CONFIG_SMP
@@ -241,25 +241,25 @@ void __init collect_boot_cpu_data(void)
241241
/* get CPU-Model Information... */
242242
#define p ((unsigned long *)&boot_cpu_data.pdc.model)
243243
if (pdc_model_info(&boot_cpu_data.pdc.model) == PDC_OK) {
244-
printk(KERN_INFO
245-
"model %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
246-
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]);
244+
pr_info("model 0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx "
245+
"0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx\n",
246+
p[0], p[1], p[2], p[3], p[4],
247+
p[5], p[6], p[7], p[8], p[9]);
247248

248249
add_device_randomness(&boot_cpu_data.pdc.model,
249250
sizeof(boot_cpu_data.pdc.model));
250251
}
251252
#undef p
252253

253254
if (pdc_model_versions(&boot_cpu_data.pdc.versions, 0) == PDC_OK) {
254-
printk(KERN_INFO "vers %08lx\n",
255-
boot_cpu_data.pdc.versions);
255+
pr_info("vers 0x%04lx\n", boot_cpu_data.pdc.versions);
256256

257257
add_device_randomness(&boot_cpu_data.pdc.versions,
258258
sizeof(boot_cpu_data.pdc.versions));
259259
}
260260

261261
if (pdc_model_cpuid(&boot_cpu_data.pdc.cpuid) == PDC_OK) {
262-
printk(KERN_INFO "CPUID vers %ld rev %ld (0x%08lx)\n",
262+
pr_info("CPUID vers %ld rev %ld (0x%04lx)\n",
263263
(boot_cpu_data.pdc.cpuid >> 5) & 127,
264264
boot_cpu_data.pdc.cpuid & 31,
265265
boot_cpu_data.pdc.cpuid);
@@ -437,8 +437,8 @@ show_cpuinfo (struct seq_file *m, void *v)
437437
boot_cpu_data.pdc.sys_model_name,
438438
cpu_name);
439439

440-
seq_printf(m, "hversion\t: 0x%08x\n"
441-
"sversion\t: 0x%08x\n",
440+
seq_printf(m, "hversion\t: 0x%04x\n"
441+
"sversion\t: 0x%04x\n",
442442
boot_cpu_data.hversion,
443443
boot_cpu_data.sversion );
444444

arch/parisc/kernel/time.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/rtc.h>
1717
#include <linux/platform_device.h>
1818
#include <asm/processor.h>
19+
#include <asm/pdcpat.h>
1920

2021
static u64 cr16_clock_freq;
2122
static unsigned long clocktick;
@@ -99,6 +100,22 @@ void parisc_clockevent_init(void)
99100
clockevents_config_and_register(cd, cr16_clock_freq, min_delta, max_delta);
100101
}
101102

103+
static void parisc_find_64bit_counter(void)
104+
{
105+
#ifdef CONFIG_64BIT
106+
uint64_t *pclock;
107+
unsigned long freq, unique;
108+
int ret;
109+
110+
ret = pdc_pat_pd_get_platform_counter(&pclock, &freq, &unique);
111+
if (ret == PDC_OK)
112+
pr_info("64-bit counter found at %px, freq: %lu, unique: %lu\n",
113+
pclock, freq, unique);
114+
else
115+
pr_info("64-bit counter not found.\n");
116+
#endif
117+
}
118+
102119
unsigned long notrace profile_pc(struct pt_regs *regs)
103120
{
104121
unsigned long pc = instruction_pointer(regs);
@@ -213,6 +230,9 @@ void __init time_init(void)
213230

214231
parisc_clockevent_init();
215232

233+
/* check for free-running 64-bit platform counter */
234+
parisc_find_64bit_counter();
235+
216236
/* register at clocksource framework */
217237
clocksource_register_hz(&clocksource_cr16, cr16_clock_freq);
218238
}

drivers/parisc/iosapic.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ iosapic_load_irt(unsigned long cell_num, struct irt_entry **irt)
262262

263263
if (is_pdc_pat()) {
264264
/* Use pat pdc routine to get interrupt routing table size */
265-
DBG("calling get_irt_size (cell %ld)\n", cell_num);
266265
status = pdc_pat_get_irt_size(&num_entries, cell_num);
267-
DBG("get_irt_size: %ld\n", status);
266+
DBG("calling get_irt_size (cell %ld) ", cell_num);
267+
DBG("returned %ld, entries: %lu\n", status, num_entries);
268268

269269
BUG_ON(status != PDC_OK);
270270
BUG_ON(num_entries == 0);
@@ -327,7 +327,7 @@ iosapic_load_irt(unsigned long cell_num, struct irt_entry **irt)
327327
int i;
328328

329329
printk(MODULE_NAME " Interrupt Routing Table (cell %ld)\n", cell_num);
330-
printk(MODULE_NAME " start = 0x%p num_entries %ld entry_size %d\n",
330+
printk(MODULE_NAME " start = 0x%px num_entries %ld entry_size %d\n",
331331
table,
332332
num_entries,
333333
(int) sizeof(struct irt_entry));
@@ -455,7 +455,7 @@ iosapic_xlate_pin(struct iosapic_info *isi, struct pci_dev *pcidev)
455455
pci_read_config_byte(pcidev, PCI_INTERRUPT_PIN, &intr_pin);
456456

457457
DBG_IRT("iosapic_xlate_pin(%s) SLOT %d pin %d\n",
458-
pcidev->slot_name, PCI_SLOT(pcidev->devfn), intr_pin);
458+
pci_name(pcidev), PCI_SLOT(pcidev->devfn), intr_pin);
459459

460460
if (intr_pin == 0) {
461461
/* The device does NOT support/use IRQ lines. */
@@ -508,7 +508,7 @@ iosapic_xlate_pin(struct iosapic_info *isi, struct pci_dev *pcidev)
508508
} else {
509509
intr_slot = PCI_SLOT(pcidev->devfn);
510510
}
511-
DBG_IRT("iosapic_xlate_pin: bus %d slot %d pin %d\n",
511+
DBG_IRT("iosapic_xlate_pin: bus %lld slot %d pin %d\n",
512512
pcidev->bus->busn_res.start, intr_slot, intr_pin);
513513

514514
return irt_find_irqline(isi, intr_slot, intr_pin);
@@ -733,7 +733,7 @@ int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev)
733733
pci_name(pcidev));
734734
return -1;
735735
}
736-
DBG_IRT("iosapic_fixup_irq(): irte %p %x %x %x %x %x %x %x %x\n",
736+
DBG_IRT("iosapic_fixup_irq(): irte %px %02x %02x %02x %02x %02x %02x %02x %04llx\n",
737737
irte,
738738
irte->entry_type,
739739
irte->entry_length,
@@ -742,12 +742,12 @@ int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev)
742742
irte->src_bus_id,
743743
irte->src_seg_id,
744744
irte->dest_iosapic_intin,
745-
(u32) irte->dest_iosapic_addr);
745+
irte->dest_iosapic_addr);
746746
isi_line = irte->dest_iosapic_intin;
747747

748748
/* get vector info for this input line */
749749
vi = isi->isi_vector + isi_line;
750-
DBG_IRT("iosapic_fixup_irq: line %d vi 0x%p\n", isi_line, vi);
750+
DBG_IRT("iosapic_fixup_irq: line %d vi 0x%px\n", isi_line, vi);
751751

752752
/* If this IRQ line has already been setup, skip it */
753753
if (vi->irte)
@@ -772,6 +772,8 @@ int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev)
772772
/* enable_irq() will use txn_* to program IRdT */
773773
vi->txn_addr = txn_alloc_addr(vi->txn_irq);
774774
vi->txn_data = txn_alloc_data(vi->txn_irq);
775+
DBG_IRT("iosapic_fixup_irq() TXN: 0x%lx 0x%x\n",
776+
vi->txn_addr, vi->txn_data);
775777

776778
vi->eoi_addr = isi->addr + IOSAPIC_REG_EOI;
777779
vi->eoi_data = cpu_to_le32(vi->txn_data);
@@ -831,7 +833,7 @@ int iosapic_serial_irq(struct parisc_device *dev)
831833

832834
/* get vector info for this input line */
833835
vi = isi->isi_vector + intin;
834-
DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", iosapic_intin, vi);
836+
DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", intin, vi);
835837

836838
/* If this IRQ line has already been setup, skip it */
837839
if (vi->irte)
@@ -923,6 +925,7 @@ void *iosapic_register(unsigned long hpa, void __iomem *vaddr)
923925
isi->isi_hpa = hpa;
924926
isi->isi_version = iosapic_rd_version(isi);
925927
isi->isi_num_vectors = IOSAPIC_IRDT_MAX_ENTRY(isi->isi_version) + 1;
928+
DBG_IRT("iosapic_register: num vectors = %d\n", isi->isi_num_vectors);
926929

927930
vip = isi->isi_vector = kcalloc(isi->isi_num_vectors,
928931
sizeof(struct vector_info), GFP_KERNEL);

drivers/parisc/lba_pci.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,10 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
10661066

10671067
p = (void *) &(pa_pdc_cell->mod[2+i*3]);
10681068
io = (void *) &(io_pdc_cell->mod[2+i*3]);
1069+
DBG_PAT("PA #%d : TYPE 0x%08lx, start 0x%08lx, end 0x%08lx\n",
1070+
i, p->type, p->start, p->end);
1071+
DBG_PAT("IO #%d : TYPE 0x%08lx, start 0x%08lx, end 0x%08lx\n",
1072+
i, io->type, io->start, io->end);
10691073

10701074
/* Convert the PAT range data to PCI "struct resource" */
10711075
switch(p->type & 0xff) {

0 commit comments

Comments
 (0)